mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
@@ -144,13 +144,16 @@ class AccountBankStatementLine(models.Model):
|
||||
new_data,
|
||||
self.reconcile_data_info["reconcile_auxiliary_id"],
|
||||
self.manual_reference,
|
||||
exchange_recompute=True,
|
||||
)
|
||||
self.can_reconcile = self.reconcile_data_info.get("can_reconcile", False)
|
||||
self.add_account_move_line_id = False
|
||||
|
||||
def _recompute_suspense_line(self, data, reconcile_auxiliary_id, manual_reference):
|
||||
def _recompute_suspense_line(
|
||||
self, data, reconcile_auxiliary_id, manual_reference, exchange_recompute=False
|
||||
):
|
||||
reconcile_auxiliary_id = self._compute_exchange_rate(
|
||||
data, reconcile_auxiliary_id
|
||||
data, reconcile_auxiliary_id, exchange_recompute=exchange_recompute
|
||||
)
|
||||
can_reconcile = True
|
||||
total_amount = 0
|
||||
@@ -393,7 +396,11 @@ class AccountBankStatementLine(models.Model):
|
||||
new_data.append(new_line)
|
||||
return new_data, reconcile_auxiliary_id
|
||||
|
||||
def _compute_exchange_rate(self, data, reconcile_auxiliary_id):
|
||||
def _compute_exchange_rate(
|
||||
self, data, reconcile_auxiliary_id, exchange_recompute=False
|
||||
):
|
||||
if not exchange_recompute:
|
||||
return reconcile_auxiliary_id
|
||||
foreign_currency = (
|
||||
self.currency_id != self.company_id.currency_id
|
||||
or self.foreign_currency_id
|
||||
@@ -416,6 +423,7 @@ class AccountBankStatementLine(models.Model):
|
||||
"date": fields.Date.to_string(self.date),
|
||||
"name": self.payment_ref or self.name,
|
||||
"amount": -amount,
|
||||
"net_amount": -amount,
|
||||
"credit": amount if amount > 0 else 0.0,
|
||||
"debit": -amount if amount < 0 else 0.0,
|
||||
"kind": "other",
|
||||
@@ -444,7 +452,8 @@ class AccountBankStatementLine(models.Model):
|
||||
*self._reconcile_data_by_model(
|
||||
data, res["model"], reconcile_auxiliary_id
|
||||
),
|
||||
self.manual_reference
|
||||
self.manual_reference,
|
||||
exchange_recompute=True
|
||||
)
|
||||
elif res and res.get("amls"):
|
||||
amount = self.amount_total_signed
|
||||
@@ -455,7 +464,10 @@ class AccountBankStatementLine(models.Model):
|
||||
amount -= line_data.get("amount")
|
||||
data.append(line_data)
|
||||
return self._recompute_suspense_line(
|
||||
data, reconcile_auxiliary_id, self.manual_reference
|
||||
data,
|
||||
reconcile_auxiliary_id,
|
||||
self.manual_reference,
|
||||
exchange_recompute=True,
|
||||
)
|
||||
return self._recompute_suspense_line(
|
||||
data
|
||||
@@ -643,7 +655,8 @@ class AccountBankStatementLine(models.Model):
|
||||
*record._reconcile_data_by_model(
|
||||
data, res["model"], reconcile_auxiliary_id
|
||||
),
|
||||
self.manual_reference
|
||||
self.manual_reference,
|
||||
exchange_recompute=True
|
||||
)
|
||||
elif res.get("amls"):
|
||||
amount = self.amount
|
||||
@@ -654,7 +667,10 @@ class AccountBankStatementLine(models.Model):
|
||||
amount -= line_data.get("amount")
|
||||
data.append(line_data)
|
||||
data = record._recompute_suspense_line(
|
||||
data, reconcile_auxiliary_id, self.manual_reference
|
||||
data,
|
||||
reconcile_auxiliary_id,
|
||||
self.manual_reference,
|
||||
exchange_recompute=True,
|
||||
)
|
||||
if not data.get("can_reconcile"):
|
||||
continue
|
||||
@@ -704,7 +720,10 @@ class AccountBankStatementLine(models.Model):
|
||||
else:
|
||||
new_data.append(line)
|
||||
self.reconcile_data_info = self._recompute_suspense_line(
|
||||
new_data, reconcile_auxiliary_id, self.manual_reference
|
||||
new_data,
|
||||
reconcile_auxiliary_id,
|
||||
self.manual_reference,
|
||||
exchange_recompute=True,
|
||||
)
|
||||
self.can_reconcile = self.reconcile_data_info.get("can_reconcile", False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user