Hello,
I have a form that takes data with a on_change function an show it when i select an employee but i realize that when i hit the save button and check the record i just created all the data that i acquired with the on_change function is gone... why this might be?
I am putting here my on_change function and the view, thanks in advance.
def onchange_petitioner(self, cr, uid, ids, origin_employee_id, context=None):
hr_obj = self.pool.get('hr.employee')
if origin_employee_id:
employee = hr_obj.browse(cr, uid, origin_employee_id, context=None)
return {'value':{'origin_address':employee.company_id.partner_id.street,
'origin_department_id':employee.department_id.id,
'origin_company_id':employee.company_id.id,
'origin_state_id':employee.company_id.partner_id.state_id.id}}
else:
return {}
def onchange_petitionee(self, cr, uid, ids, employee_id, context=None):
hr_obj = self.pool.get('hr.employee')
hr_contract_obj = self.pool.get('hr.contract')
if employee_id:
emp = hr_obj.browse(cr, uid, employee_id, context=None)
hr_first_contract = hr_contract_obj.search(cr, uid, [], limit=1, context=None)
emp_cont = hr_contract_obj.browse(cr, uid, hr_first_contract[0], context=None)
return {'value':{'actual_employee_code':emp.employee_code,
'actual_identifiaction_id':emp.identification_id,
'actual_dependency':emp.department_id.id,
'actual_ocupation':emp.job_id.id,
'actual_salary_scale_category':emp.salary_scale_category,
'actual_salary_scale_level':emp.salary_scale_level,
'actual_orderly_turn':emp.orderly_turn,
'actual_wage':emp_cont.wage
}}
View:
↧