From 7201bc0250e460e13698d453018c2a83b75cbc5e Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 30 Sep 2014 16:17:57 +0200 Subject: [PATCH] [FIX] hr_payroll_account: do not create entries with amount at 0 If the salary compuation gives a salary of zero, skip the creation of the account.move.line (not good to have lines at 0). Fixes lp:1298116, opw 605816 --- addons/hr_payroll_account/hr_payroll_account.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/hr_payroll_account/hr_payroll_account.py b/addons/hr_payroll_account/hr_payroll_account.py index 9e892682e96..d6385c6f92b 100644 --- a/addons/hr_payroll_account/hr_payroll_account.py +++ b/addons/hr_payroll_account/hr_payroll_account.py @@ -24,7 +24,7 @@ from openerp import netsvc from datetime import date, datetime, timedelta from openerp.osv import fields, osv -from openerp.tools import config, float_compare +from openerp.tools import float_compare, float_is_zero from openerp.tools.translate import _ class hr_payslip(osv.osv): @@ -112,6 +112,8 @@ class hr_payslip(osv.osv): } for line in slip.details_by_salary_rule_category: amt = slip.credit_note and -line.total or line.total + if float_is_zero(amt, precision_digits=precision): + continue partner_id = line.salary_rule_id.register_id.partner_id and line.salary_rule_id.register_id.partner_id.id or default_partner_id debit_account_id = line.salary_rule_id.account_debit.id credit_account_id = line.salary_rule_id.account_credit.id @@ -183,6 +185,7 @@ class hr_payslip(osv.osv): 'credit': 0.0, }) line_ids.append(adjust_debit) + move.update({'line_id': line_ids}) move_id = move_pool.create(cr, uid, move, context=context) self.write(cr, uid, [slip.id], {'move_id': move_id, 'period_id' : period_id}, context=context)