[IMP] hr_payroll:improved code of _calculate(hr.payslip) for gross and net
authormtr <mtr@mtr>
Wed, 9 Mar 2011 11:30:03 +0000 (17:00 +0530)
committermtr <mtr@mtr>
Wed, 9 Mar 2011 11:30:03 +0000 (17:00 +0530)
bzr revid: mtr@mtr-20110309113003-03rr094fnxwn5n35

addons/hr_payroll/hr_payroll.py

index 73c2a7e..ea39048 100644 (file)
@@ -377,6 +377,8 @@ class hr_payslip(osv.osv):
             allow = 0.0
             deduct = 0.0
             others = 0.0
+            tot_amount = 0.0
+           
             contract = rs.employee_id.contract_id
             obj = {'basic': contract.wage}
             if not contract.struct_id:
@@ -406,10 +408,13 @@ class hr_payslip(osv.osv):
                     allow += amount
                     others -= contrib
                     amount += contrib
+                tot_amount +=  amount
                 salary_rule_pool.write(cr, uid, [line.id], {'total': amount}, context=context)
             record = {
                 'allounce': allow,
                 'deduction': deduct,
+                'gross_amount': rs.basic_amount + allow,
+                'net_amount': rs.basic_amount + tot_amount,
                 'other_pay': others,
                 'state': 'draft',
                 'total_pay': abs(contract.wage + allow + deduct)