field 1 : many2one field
field 2 is a char field inside a one2many field
When i select field 1 value, field 2 must be updated. How can i update it using onchange or any other option?
My code:
class hr_employee(osv.osv):
_inherit = 'hr.employee'
'own_location' : fields.many2one('location.location','Own location'),
'location_line_ids': fields.one2many('employee.location', 'location_line_id', 'Location'),
When i select 'own_location' , a onchange function will call and i want to update the 'current_location' field in the below table. How can i do that?
class employee_location(osv.osv):
_name='employee.location'
_columns={
'current_location':fields.char('Current location'),
'new_location':fields.many2one('location.location','New location'),
'start_date' : fields.date('Start Date'),
'end_date' : fields.date('End Date'),
'location_line_id':fields.many2one('hr.employee','Employee location',ondelete='cascade'),
}
I tried many ways but no output. Please any one help me to solve this.
Below atchuthan code working perfectly.
I need add a new row on each onchange & update the value of current_location in a new row on each onchange.
How can i update the value of current_location in a new row on each onchange?