From bb4b07df3f617122022306d7aead2ed1e3c73419 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 27 May 2020 06:29:34 +0000 Subject: [PATCH] [FIX] account: Payment matching with cash basis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce the bug: - Let's consider the current company CY in € - Let's consider a cash basis tax T of 20% - Let's consider that 1€ = 2$ - Create a customer invoice I on journal J in € for customer C - Create a line on J with 100€ and set T on it - Post I - Create a payment P of 240$ for C on bank journal in € - Confirm P and click on payment matching - Try to reconcile P with I Bug: A traceback was raised. Fine tuning of https://github.com/odoo/odoo/commit/0497c311e790454deb9ded2ed4fb206f5fd929ef opw:2256207 closes odoo/odoo#51952 X-original-commit: 633fc71c14e8258d2a6cb2b8ee4bcc6b41a1124f Signed-off-by: Laurent Smet Signed-off-by: Simon Goffin (sig) --- addons/account/models/account_move.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 08a0c6613df..90aa06a9034 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -4677,7 +4677,7 @@ class AccountPartialReconcile(models.Model): 'tax_ids': [(6, 0, [tax.id])], 'move_id': newly_created_move.id, 'currency_id': line.currency_id.id, - 'amount_currency': self.amount_currency and line.currency_id.round(line.amount_currency * amount / line.balance) or 0.0, + 'amount_currency': line.currency_id.round(line.amount_currency * amount / line.balance) if line.currency_id and line.balance else 0.0, 'partner_id': line.partner_id.id, 'journal_id': newly_created_move.journal_id.id, 'tax_repartition_line_id': line.tax_repartition_line_id.id, @@ -4692,7 +4692,7 @@ class AccountPartialReconcile(models.Model): 'tax_exigible': True, 'move_id': newly_created_move.id, 'currency_id': line.currency_id.id, - 'amount_currency': self.amount_currency and line.currency_id.round(-line.amount_currency * amount / line.balance) or 0.0, + 'amount_currency': line.currency_id.round(-line.amount_currency * amount / line.balance) if line.currency_id and line.balance else 0.0, 'partner_id': line.partner_id.id, 'journal_id': newly_created_move.journal_id.id, })