python 3.x - How to modify the one2many or many2one field in other model odoo10 -
can 1 tell example how modify field in model if changed in type-one2many field.
for example, have 2 models a) hr_shifts b)hr_contract in hr_shifts there one2many field(emp_name_ids) when changed in fields reflect in hr_contract after click on save button. code work, when used in one2many field (emp_name_ids) doesn't work
@api.depends('schedule') def _onchange_schedule(self): 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})
one2many
, many2many
use special "commands" format manipulate set of records stored in/associated field.
you should try:
current.write({'emp_name_ids': [(6, 0, [ids])]})
for more info regarding special commands see docs: https://www.odoo.com/documentation/10.0/reference/orm.html#model-reference.
scroll bit down crud section there find possible commands ((6, _, ids)
1 of few more).
Comments
Post a Comment