From ca0b7a4f1e7f22dd7a3fe9e14aa58f67ff17e80a Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Wed, 22 Jan 2025 13:02:48 +0100 Subject: [PATCH] [FIX] Wrong amount currency compute in case of change in liquidity line --- account_reconcile_oca/models/account_bank_statement_line.py | 5 +++-- account_reconcile_oca/tests/test_bank_account_reconcile.py | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/account_reconcile_oca/models/account_bank_statement_line.py b/account_reconcile_oca/models/account_bank_statement_line.py index a7294bcb8..0e1479fc6 100644 --- a/account_reconcile_oca/models/account_bank_statement_line.py +++ b/account_reconcile_oca/models/account_bank_statement_line.py @@ -442,10 +442,11 @@ def _get_manual_reconcile_vals(self): "debit": self.manual_amount if self.manual_amount > 0 else 0.0, "analytic_distribution": self.analytic_distribution, } - if self.manual_line_id: + liquidity_lines, _suspense_lines, _other_lines = self._seek_for_lines() + if self.manual_line_id and self.manual_line_id.id not in liquidity_lines.ids: vals.update( { - "currency_amount": self.manual_line_id.currency_id._convert( + "currency_amount": self.manual_currency_id._convert( self.manual_amount, self.manual_in_currency_id, self.company_id, diff --git a/account_reconcile_oca/tests/test_bank_account_reconcile.py b/account_reconcile_oca/tests/test_bank_account_reconcile.py index f9533ea31..4203b56f2 100644 --- a/account_reconcile_oca/tests/test_bank_account_reconcile.py +++ b/account_reconcile_oca/tests/test_bank_account_reconcile.py @@ -1260,7 +1260,10 @@ def test_invoice_foreign_currency_late_change_of_rate(self): ) f.manual_reference = "account.move.line;%s" % line["id"] # simulate click on statement line, check amount does not recompute + f.manual_partner_id = inv1.partner_id self.assertEqual(f.manual_amount, 83.33) + # check currency amount is still fine + self.assertEqual(f.reconcile_data_info["data"][0]["currency_amount"], 100) f.add_account_move_line_id = inv1.line_ids.filtered( lambda l: l.account_id.account_type == "asset_receivable" )