Can any one tell with example how to modify the field in another model if changed in type-one2many field.
For example, I have two models a) hr_shifts b)hr_contract
in hr_shifts there is one2many field(emp_name_ids) when changed in this fields reflect in hr_contract after click on save button.
this code work, but when I used in one2many field (emp_name_ids) it doesn't work
@api.depends('schedule')
def _onchange_schedule(self):
for item in self.hr_shifts_line:
current=self.env['hr.contract'].search([('employee_id','=',item.emp_name_ids.id)])
current.write({'working_hours':self.schedule.id})
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…