[FIX] account_reconcile_oca : max_amount rounding error leading to unwanted currency conversion

pull/808/head
Florian da Costa 2024-11-05 12:59:25 +01:00 committed by Jordi Ballester Alomar
parent bf6e1d23a0
commit 829299dffe
1 changed files with 3 additions and 4 deletions

View File

@ -198,11 +198,10 @@ class AccountBankStatementLine(models.Model):
new_data = [] new_data = []
is_new_line = True is_new_line = True
pending_amount = 0.0 pending_amount = 0.0
currency = self._get_reconcile_currency()
for line in data: for line in data:
if line["kind"] != "suspense": if line["kind"] != "suspense":
pending_amount += self._get_amount_currency( pending_amount += self._get_amount_currency(line, currency)
line, self._get_reconcile_currency()
)
if self.add_account_move_line_id.id in line.get( if self.add_account_move_line_id.id in line.get(
"counterpart_line_ids", [] "counterpart_line_ids", []
): ):
@ -214,7 +213,7 @@ class AccountBankStatementLine(models.Model):
self.add_account_move_line_id, self.add_account_move_line_id,
"other", "other",
True, True,
max_amount=pending_amount, max_amount=currency.round(pending_amount),
move=True, move=True,
) )
new_data += lines new_data += lines