Hi Everyone.I have a situation here in v9.I have customized a form for employee benfits.
class HROvertime(osv.osv):
_name = "hr.overtime"
_description = "HR Overtime"
_columns = {
'name': fields.char('Name', size=256, required=True),
'date_start': fields.date('Start Date',required=True,readonly=True),
'date_end': fields.date('End Date',required=True,readonly=True),
'employee_id': fields.many2one('hr.employee','Employee',required=True),
'contract_id': fields.many2one('hr.contract','Contract',required=True),
'user_id': fields.many2one('res.users','User'),
'hours_claimed': fields.float(string='Total Hours Claimed', store=True, readonly=True, compute='_total_hours', track_visibility='always'),
'overtime_ids': fields.one2many('hr.overtime.line','overtime_id','HR Overtime Line'),
}
-----------------------------------------------------------------------------------
the fields below are for one2many lines:
class HROvertimeLine(osv.osv):
_name = "hr.overtime.line"
_description = "HR Overtime Line"
_columns = {
'overtime_id': fields.many2one('hr.overtime','HR Overtime'),
'name': fields.char('Description', size=256),
'date': fields.date('Date'),
'hours_claimed': fields.float('Hours Claimed'),
'salary_rule_id': fields.many2one('hr.salary.rule','Salary Rule'),
'approved': fields.boolean('Approved'),
}
---------------------------------------------------------------------------------------------------------------
here for salary_rule_id, i have defined new field named 'job_ids' as many2many fieldin hr.salary.rule object(so we can assign some job type's(hr.job).
class HRSalaryRule(osv.osv):
_inherit = "hr.salary.rule"
_columns = {
'job_ids':fields.many2many('hr.job', 'hr_job_salary_rule_rel', 'job_id', 'rule_id', 'Job Title'),
}
So i can configure some of job type's in this many2many field, so can restrict displaying all salary rules except assigned job type of particular employee.
I mean if i select employee in Overtime form(hr.overtime), then in one2many line item when i select salary_rule_id, i can have only selected employee's job type salary rules only filtered for selection.Kindly give me the domain filteration for this issue.Thanks in advance.