[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.
This commit is contained in:
qdp-odoo
2018-08-21 16:41:40 +02:00
parent 132d9ad18b
commit 0c34698c47
@@ -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: