[IMP] hr_payroll:improved code of _calculate(hr.payslip) for gross and net

bzr revid: mtr@mtr-20110309113003-03rr094fnxwn5n35
This commit is contained in:
mtr
2011-03-09 17:00:03 +05:30
parent 5b0fdb52a9
commit f0e3ce0dbb
+5
View 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)