From f233bd317ab0489302f75a5d38da270bb7740d6c Mon Sep 17 00:00:00 2001 From: "olt@tinyerp.com" <> Date: Tue, 5 Oct 2010 13:19:29 +0200 Subject: [PATCH] [IMP] hr_payroll: 'payslip' report now uses decimal.precision bzr revid: olt@tinyerp.com-20101005111929-ij6mgz6a3fkechm6 --- addons/hr_payroll/hr_payroll.py | 7 +++--- addons/hr_payroll/report/payslip.rml | 26 +++++++++++----------- addons/hr_payroll/report/report_payslip.py | 13 ----------- 3 files changed, 17 insertions(+), 29 deletions(-) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index d7de7efbcbc..7ce1faace82 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -27,6 +27,7 @@ import netsvc from osv import fields, osv from tools import config from tools.translate import _ +import decimal_precision as dp @@ -774,9 +775,9 @@ class hr_payslip(osv.osv): ('done','Paid Salary'), ('cancel','Reject'), ],'State', select=True, readonly=True), - 'basic_before_leaves': fields.float('Basic Salary', readonly=True, digits=(16, 2)), - 'leaves': fields.float('Leave Deductions', readonly=True, digits=(16, 2)), - 'basic': fields.float('Net Basic', readonly=True, digits=(16, 2)), + 'basic_before_leaves': fields.float('Basic Salary', readonly=True, digits_compute=dp.get_precision('Account')), + 'leaves': fields.float('Leave Deductions', readonly=True, digits_compute=dp.get_precision('Account')), + 'basic': fields.float('Net Basic', readonly=True, digits_compute=dp.get_precision('Account')), 'grows': fields.function(_calculate, method=True, store=True, multi='dc', string='Gross Salary', type='float', digits=(16, 2)), 'net': fields.function(_calculate, method=True, store=True, multi='dc', string='Net Salary', digits=(16, 2)), 'allounce': fields.function(_calculate, method=True, store=True, multi='dc', string='Allowance', digits=(16, 2)), diff --git a/addons/hr_payroll/report/payslip.rml b/addons/hr_payroll/report/payslip.rml index 58b2fd81275..075023638f3 100755 --- a/addons/hr_payroll/report/payslip.rml +++ b/addons/hr_payroll/report/payslip.rml @@ -392,19 +392,19 @@ Basic Salary - [[ formatLang(o.basic_before_leaves) ]] [[ o.company_id.currency_id.symbol ]] + [[ formatLang(o.basic_before_leaves, dp='Account') ]] [[ o.company_id.currency_id.symbol ]] Leaved Deduction - [[ o.leaves or '' ]] + [[ formatLang(o.leaves, dp='Account') ]] [[ o.company_id.currency_id.symbol ]] Basic Salary – Leaves - [[ formatLang(o.basic) ]] [[ o.company_id.currency_id.symbol ]] + [[ formatLang(o.basic, dp='Account') ]] [[ o.company_id.currency_id.symbol ]] @@ -433,7 +433,7 @@ [[ ld.code ]] - [[ formatLang(ld.total) ]] [[ o.company_id.currency_id.symbol ]] + [[ formatLang(ld.total, dp='Account') ]] [[ o.company_id.currency_id.symbol ]] @@ -463,7 +463,7 @@ Basic Salary - [[ formatLang(o.basic) ]] [[ o.company_id.currency_id.symbol ]] + [[ formatLang(o.basic, dp='Account') ]] [[ o.company_id.currency_id.symbol ]] @@ -471,7 +471,7 @@ [[repeatIn(get_earnings(o.line_ids),'a') ]] [[ a.code or removeParentNode('tr') ]] - [[ formatLang(a.total) ]] [[ o.company_id.currency_id.symbol ]] + [[ formatLang(a.total, dp='Account') ]] [[ o.company_id.currency_id.symbol ]] @@ -488,7 +488,7 @@ [[ b.code ]] - [[ formatLang(b.total) ]] [[ o.company_id.currency_id.symbol ]] + [[ formatLang(b.total, dp='Account') ]] [[ o.company_id.currency_id.symbol ]] @@ -508,13 +508,13 @@ Total Earnings([[ o.company_id.currency_id.code ]]) - [[ formatLang(o.allounce + o.basic) ]] [[ o.company_id.currency_id.symbol ]] + [[ formatLang(o.allounce + o.basic, dp='Account') ]] [[ o.company_id.currency_id.symbol ]] Total Deductions([[ o.company_id.currency_id.code ]]) - [[ formatLang(o.deduction) ]] [[ o.company_id.currency_id.symbol ]] + [[ formatLang(o.deduction, dp='Account') ]] [[ o.company_id.currency_id.symbol ]] @@ -542,10 +542,10 @@ [[ ol.type in ['advance','loan','otherpay','otherdeduct','installment'] and ol.code or '' ]] - [[ ol.type in ['advance','loan','otherpay'] and formatLang(ol.total) or '' ]] [[ ol.type in ['advance','loan','otherpay'] and o.company_id.currency_id.symbol or '' ]] + [[ ol.type in ['advance','loan','otherpay'] and formatLang(ol.total, dp='Account') or '' ]] [[ ol.type in ['advance','loan','otherpay'] and o.company_id.currency_id.symbol or '' ]] - [[ ol.type in ['otherdeduct','installment'] and formatLang(ol.total) or '' ]] [[ ol.type in ['advance','loan','otherpay'] and o.company_id.currency_id.symbol or '' ]] + [[ ol.type in ['otherdeduct','installment'] and formatLang(ol.total, dp='Account') or '' ]] [[ ol.type in ['advance','loan','otherpay'] and o.company_id.currency_id.symbol or '' ]] @@ -561,7 +561,7 @@ Net Amount([[ o.company_id.currency_id.code ]]) - [[ formatLang(o.net) ]] [[ o.company_id.currency_id.symbol ]] + [[ formatLang(o.net, dp='Account') ]] [[ o.company_id.currency_id.symbol ]] @@ -609,4 +609,4 @@ - \ No newline at end of file + diff --git a/addons/hr_payroll/report/report_payslip.py b/addons/hr_payroll/report/report_payslip.py index e818e0f3727..c0d3946d3ef 100755 --- a/addons/hr_payroll/report/report_payslip.py +++ b/addons/hr_payroll/report/report_payslip.py @@ -99,18 +99,5 @@ class payslip_report(report_sxw.rml_parse): report_sxw.report_sxw('report.payslip.pdf', 'hr.payslip', 'hr_payroll/report/payslip.rml', parser=payslip_report) - - - - - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - - - - - - - -