[FIX] account: Payment matching with cash basis

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 <smetl@users.noreply.github.com>
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2020-05-27 11:58:54 +00:00
parent 4fc0f2c042
commit bb4b07df3f
+2 -2
View File
@@ -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,
})