[FIX] hr_payroll: do not unlink records in onchange method
Fixing the error ValueError: "name 'date_from' is not defined" while evaluating '[date_from, date_to, employee_id, contract_id]' This commit close #12383, close #8883, close #3116
This commit is contained in:
parent
2219c83aac
commit
d43d1ddf4b
|
@ -628,21 +628,23 @@ class hr_payslip(osv.osv):
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
#delete old worked days lines
|
#delete old worked days lines
|
||||||
|
worked_days_ids_to_remove=[]
|
||||||
old_worked_days_ids = ids and worked_days_obj.search(cr, uid, [('payslip_id', '=', ids[0])], context=context) or False
|
old_worked_days_ids = ids and worked_days_obj.search(cr, uid, [('payslip_id', '=', ids[0])], context=context) or False
|
||||||
if old_worked_days_ids:
|
if old_worked_days_ids:
|
||||||
worked_days_obj.unlink(cr, uid, old_worked_days_ids, context=context)
|
worked_days_ids_to_remove = map(lambda x: (2, x,),old_worked_days_ids)
|
||||||
|
|
||||||
#delete old input lines
|
#delete old input lines
|
||||||
|
input_line_ids_to_remove=[]
|
||||||
old_input_ids = ids and input_obj.search(cr, uid, [('payslip_id', '=', ids[0])], context=context) or False
|
old_input_ids = ids and input_obj.search(cr, uid, [('payslip_id', '=', ids[0])], context=context) or False
|
||||||
if old_input_ids:
|
if old_input_ids:
|
||||||
input_obj.unlink(cr, uid, old_input_ids, context=context)
|
input_line_ids_to_remove = map(lambda x: (2,x,), old_input_ids)
|
||||||
|
|
||||||
|
|
||||||
#defaults
|
#defaults
|
||||||
res = {'value':{
|
res = {'value':{
|
||||||
'line_ids':[],
|
'line_ids':[],
|
||||||
'input_line_ids': [],
|
'input_line_ids': input_line_ids_to_remove,
|
||||||
'worked_days_line_ids': [],
|
'worked_days_line_ids': worked_days_ids_to_remove,
|
||||||
#'details_by_salary_head':[], TODO put me back
|
#'details_by_salary_head':[], TODO put me back
|
||||||
'name':'',
|
'name':'',
|
||||||
'contract_id': False,
|
'contract_id': False,
|
||||||
|
|
Loading…
Reference in New Issue