Skip to content

Commit

Permalink
[IMP] account_reconcile_oca: Compute the currency amount with less ch…
Browse files Browse the repository at this point in the history
…anges
  • Loading branch information
etobella committed Sep 15, 2024
1 parent fb2d062 commit c7ec107
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions account_reconcile_oca/models/account_bank_statement_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ def _onchange_add_account_move_line_id(self):
def _recompute_suspense_line(self, data, reconcile_auxiliary_id, manual_reference):
can_reconcile = True
total_amount = 0
currency_amount = 0
new_data = []
suspense_line = False
counterparts = []
Expand All @@ -243,15 +244,30 @@ def _recompute_suspense_line(self, data, reconcile_auxiliary_id, manual_referenc
if line["kind"] != "suspense":
new_data.append(line)
total_amount += line["amount"]
if line.get("currency_amount"):
currency_amount += (
self.env["res.currency"]
.browse(line["line_currency_id"])
._convert(
line["currency_amount"],
self._get_reconcile_currency(),
self.company_id,
self.date,
)
)
else:
currency_amount += self.company_id.currency_id._convert(
line["amount"],
self._get_reconcile_currency(),
self.company_id,
self.date,
)
else:
suspense_line = line
if not float_is_zero(
total_amount, precision_digits=self.company_id.currency_id.decimal_places
):
can_reconcile = False
currency_amount = self.company_id.currency_id._convert(
total_amount, self._get_reconcile_currency(), self.company_id, self.date
)
if suspense_line:
suspense_line.update(
{
Expand Down

0 comments on commit c7ec107

Please sign in to comment.