From 3db40d16307fda319ab6b51e023c21965bd83c83 Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Fri, 13 Sep 2024 10:33:50 +0200 Subject: [PATCH] [IMP] account_reconcile_oca: Improve multicurrency management --- .../models/account_bank_statement_line.py | 10 ++++++++-- 1 file changed, 8 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 e6fcac831..e5e04c2c7 100644 --- a/account_reconcile_oca/models/account_bank_statement_line.py +++ b/account_reconcile_oca/models/account_bank_statement_line.py @@ -237,6 +237,9 @@ def _recompute_suspense_line(self, data, reconcile_auxiliary_id, manual_referenc total_amount, precision_digits=self.currency_id.decimal_places ): can_reconcile = False + currency_amount = self.company_id.currency_id._convert( + total_amount, self.currency_id, self.company_id, self.date + ) if suspense_line: suspense_line.update( { @@ -246,6 +249,7 @@ def _recompute_suspense_line(self, data, reconcile_auxiliary_id, manual_referenc } ) else: + suspense_line = { "reference": "reconcile_auxiliary;%s" % reconcile_auxiliary_id, "id": False, @@ -260,8 +264,8 @@ def _recompute_suspense_line(self, data, reconcile_auxiliary_id, manual_referenc "debit": -total_amount if total_amount < 0 else 0.0, "kind": "suspense", "currency_id": self.company_id.currency_id.id, - "line_currency_id": self.company_id.currency_id.id, - "currency_amount": -total_amount, + "line_currency_id": self.currency_id.id, + "currency_amount": -currency_amount, } reconcile_auxiliary_id += 1 new_data.append(suspense_line) @@ -723,6 +727,8 @@ def _reconcile_move_line_vals(self, line, move_id=False): "partner_id": line.get("partner_id") and line["partner_id"][0], "credit": line["credit"], "debit": line["debit"], + "currency_id": line.get("line_currency_id", self.company_id.currency_id.id), + "amount_currency": line.get("currency_amount", 0.0), "tax_ids": line.get("tax_ids", []), "tax_tag_ids": line.get("tax_tag_ids", []), "group_tax_id": line.get("group_tax_id"),