From f0e3ce0dbbeb3ad8d5998501afbfb18a5d129712 Mon Sep 17 00:00:00 2001 From: mtr Date: Wed, 9 Mar 2011 17:00:03 +0530 Subject: [PATCH] [IMP] hr_payroll:improved code of _calculate(hr.payslip) for gross and net bzr revid: mtr@mtr-20110309113003-03rr094fnxwn5n35 --- addons/hr_payroll/hr_payroll.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index 73c2a7e7b5e..ea39048d34c 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -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)