[FIX] account: fix exigibility of cash basis rounding corrections in exchange move

When reconciling an invoice using cash basis taxes with multiple payments, it is possible that some base or tax amount falls victim of rounding errors (for example, a tax amount of 9.99 would become 4,49 when paying the invoice with two payments of half its amount, hence loosing one cent).

In this case, when the invoice gets fully paid, we fix that by using adjustment lines in an exchange difference entry (even in monocurrency).

The bug we fix here is that the lines added into this exchange difference entry were never considered as tax exigible, and hence never appeared in the tax report, even though they should. This was due to the fact tax exigibility is recomputed automatically when creating the entry, so the value needs to be set afterwards.

OPW 2888592

closes odoo/odoo#104564

X-original-commit: cc924d5c91ccbb05f0f076faf5da8fbd739660b2
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
This commit is contained in:
oco-odoo
2022-10-31 10:41:51 +01:00
parent 27622ecbbf
commit d4cfe838c2
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -189,7 +189,7 @@ class AccountMove(models.Model):
# used by cash basis taxes, telling the lines of the move are always
# exigible. This happens if the move contains no payable or receivable line.
always_tax_exigible = fields.Boolean(compute='_compute_always_tax_exigible', store=True)
always_tax_exigible = fields.Boolean(compute='_compute_always_tax_exigible', store=True, readonly=False)
# === Misc fields === #
auto_post = fields.Selection(
@@ -1916,6 +1916,7 @@ class AccountMoveLine(models.Model):
'date': max(exchange_date or date.min, company._get_user_fiscal_lock_date() + timedelta(days=1)),
'journal_id': journal.id,
'line_ids': [],
'always_tax_exigible': True,
}
to_reconcile = []