Merge lp:~openerp-dev/openobject-addons/7.0-opw-605859-pna into lp:openobject-addons/7.0

Proposed by Pinakin Nayi (OpenERP)
Status: Merged
Merged at revision: 9947
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-605859-pna
Merge into: lp:openobject-addons/7.0
Diff against target: 26 lines (+3/-2)
1 file modified
hr_payroll/hr_payroll.py (+3/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-605859-pna
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) (community) Approve
Naresh(OpenERP) Pending
Review via email: mp+213405@code.launchpad.net

Description of the change

Hello Sir,

I fixed issue Concerning, the hr_payroll module. When configuring payroll rules with python code.

Problem:
When creating a salary rule with python code.
If result_rate is filled for one rule, the value persists for all other rules computed with python code.

Thanks,
pna

To post a comment you must log in.
Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Merged in 7.0

revno: 9947 [merge]
revision-id: <email address hidden>

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hr_payroll/hr_payroll.py'
2--- hr_payroll/hr_payroll.py 2013-12-23 12:44:13 +0000
3+++ hr_payroll/hr_payroll.py 2014-04-02 08:30:41 +0000
4@@ -578,7 +578,7 @@
5 payslip_obj = Payslips(self.pool, cr, uid, payslip.employee_id.id, payslip)
6 rules_obj = BrowsableObject(self.pool, cr, uid, payslip.employee_id.id, rules)
7
8- localdict = {'categories': categories_obj, 'rules': rules_obj, 'payslip': payslip_obj, 'worked_days': worked_days_obj, 'inputs': input_obj}
9+ baselocaldict = {'categories': categories_obj, 'rules': rules_obj, 'payslip': payslip_obj, 'worked_days': worked_days_obj, 'inputs': input_obj}
10 #get the ids of the structures on the contracts and their parent id as well
11 structure_ids = self.pool.get('hr.contract').get_all_structures(cr, uid, contract_ids, context=context)
12 #get the rules of the structure and thier children
13@@ -588,11 +588,12 @@
14
15 for contract in self.pool.get('hr.contract').browse(cr, uid, contract_ids, context=context):
16 employee = contract.employee_id
17- localdict.update({'employee': employee, 'contract': contract})
18+ localdict = dict(baselocaldict, employee=employee, contract=contract)
19 for rule in obj_rule.browse(cr, uid, sorted_rule_ids, context=context):
20 key = rule.code + '-' + str(contract.id)
21 localdict['result'] = None
22 localdict['result_qty'] = 1.0
23+ localdict['result_rate'] = 100
24 #check if the rule can be applied
25 if obj_rule.satisfy_condition(cr, uid, rule.id, localdict, context=context) and rule.id not in blacklist:
26 #compute the amount of the rule