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'),
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'),
}
When i select 'new_location' the value of the new_location will have to updated in the 'own_location' many2one fields.
For eg: when i select 'new_location' field in my one2many field, i want to call a onchange function, in that function i want to update the value of new_location in the 'own_location' many2one field. Before that i want to clear the existng valiue in 'own_location' many2one field. Then will update the value.
How is it possible?