From 0c34698c478ab3adc7d768ad140fa4a4dd3d0969 Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Tue, 21 Aug 2018 16:41:40 +0200 Subject: [PATCH] [FIX] account_voucher: unexpected error thrown when using a tax In case of a sale receipt including a tax, the error 'cannot create unbalanced entry' was raised illegetimately. The reason was simply that the tax line was defining a debit instead of a credit. --- addons/account_voucher/models/account_voucher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher/models/account_voucher.py b/addons/account_voucher/models/account_voucher.py index fee0ecf36b6..39f83746031 100644 --- a/addons/account_voucher/models/account_voucher.py +++ b/addons/account_voucher/models/account_voucher.py @@ -317,8 +317,8 @@ class AccountVoucher(models.Model): 'move_id': move_id, 'date': self.account_date, 'partner_id': self.partner_id.id, - 'debit': tax_vals['amount'] > 0 and tax_vals['amount'] or 0.0, - 'credit': tax_vals['amount'] < 0 and -tax_vals['amount'] or 0.0, + 'debit': self.voucher_type != 'sale' and tax_vals['amount'] or 0.0, + 'credit': self.voucher_type == 'sale' and tax_vals['amount'] or 0.0, 'analytic_account_id': line.account_analytic_id and line.account_analytic_id.id or False, } if company_currency != current_currency: