From f0ae2f00ac2ea5ffbb1d3e19c79d2ee9c37b0635 Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Fri, 3 Jan 2025 14:01:50 +0100 Subject: [PATCH] [FIX] account_reconcile_oca: Update currency_amount --- .../models/account_account_reconcile.py | 4 ++-- .../models/account_bank_statement_line.py | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/account_reconcile_oca/models/account_account_reconcile.py b/account_reconcile_oca/models/account_account_reconcile.py index c03ff2eef0..590fe0bf98 100644 --- a/account_reconcile_oca/models/account_account_reconcile.py +++ b/account_reconcile_oca/models/account_account_reconcile.py @@ -166,8 +166,8 @@ def _recompute_data(self, data): lines = self._get_reconcile_line( self.env["account.move.line"].browse(line_id), "other", - True, - max_amount, + is_counterpart=True, + max_amount=max_amount, move=True, ) new_data["data"] += lines diff --git a/account_reconcile_oca/models/account_bank_statement_line.py b/account_reconcile_oca/models/account_bank_statement_line.py index 9a68a1ea22..a7294bcb8a 100644 --- a/account_reconcile_oca/models/account_bank_statement_line.py +++ b/account_reconcile_oca/models/account_bank_statement_line.py @@ -228,7 +228,7 @@ def _onchange_add_account_move_line_id(self): reconcile_auxiliary_id, lines = self._get_reconcile_line( self.add_account_move_line_id, "other", - True, + is_counterpart=True, max_amount=currency.round(pending_amount), move=True, ) @@ -429,7 +429,7 @@ def _onchange_manual_amount_in_currency(self): self._onchange_manual_reconcile_vals() def _get_manual_reconcile_vals(self): - return { + vals = { "name": self.manual_name, "partner_id": self.manual_partner_id and self.manual_partner_id.name_get()[0] @@ -442,6 +442,18 @@ 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: + vals.update( + { + "currency_amount": self.manual_line_id.currency_id._convert( + self.manual_amount, + self.manual_in_currency_id, + self.company_id, + self.manual_line_id.date, + ), + } + ) + return vals @api.onchange( "manual_account_id",