[FIX] hr_payroll: when computing pyslip lines, avoid previous rules to corrupt result_rate info in localdict and other contracts
lp bug: https://launchpad.net/bugs/1298469 fixed bzr revid: mat@openerp.com-20140402085043-n8jl2hlwh5zi6dic
This commit is contained in:
@@ -578,7 +578,7 @@ class hr_payslip(osv.osv):
|
||||
payslip_obj = Payslips(self.pool, cr, uid, payslip.employee_id.id, payslip)
|
||||
rules_obj = BrowsableObject(self.pool, cr, uid, payslip.employee_id.id, rules)
|
||||
|
||||
localdict = {'categories': categories_obj, 'rules': rules_obj, 'payslip': payslip_obj, 'worked_days': worked_days_obj, 'inputs': input_obj}
|
||||
baselocaldict = {'categories': categories_obj, 'rules': rules_obj, 'payslip': payslip_obj, 'worked_days': worked_days_obj, 'inputs': input_obj}
|
||||
#get the ids of the structures on the contracts and their parent id as well
|
||||
structure_ids = self.pool.get('hr.contract').get_all_structures(cr, uid, contract_ids, context=context)
|
||||
#get the rules of the structure and thier children
|
||||
@@ -588,11 +588,12 @@ class hr_payslip(osv.osv):
|
||||
|
||||
for contract in self.pool.get('hr.contract').browse(cr, uid, contract_ids, context=context):
|
||||
employee = contract.employee_id
|
||||
localdict.update({'employee': employee, 'contract': contract})
|
||||
localdict = dict(baselocaldict, employee=employee, contract=contract)
|
||||
for rule in obj_rule.browse(cr, uid, sorted_rule_ids, context=context):
|
||||
key = rule.code + '-' + str(contract.id)
|
||||
localdict['result'] = None
|
||||
localdict['result_qty'] = 1.0
|
||||
localdict['result_rate'] = 100
|
||||
#check if the rule can be applied
|
||||
if obj_rule.satisfy_condition(cr, uid, rule.id, localdict, context=context) and rule.id not in blacklist:
|
||||
#compute the amount of the rule
|
||||
|
||||
Reference in New Issue
Block a user