mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
Fix foreign_currency_id vs currency_id on statement
Fix 13 to 14 migration
This commit is contained in:
@@ -150,7 +150,7 @@ class AccountBankStatementLine(models.Model):
|
||||
|
||||
# Fully reconciled moves are just linked to the bank statement
|
||||
total = self.amount
|
||||
currency = self.currency_id or statement_currency
|
||||
currency = self.foreign_currency_id or statement_currency
|
||||
for aml_rec in payment_aml_rec:
|
||||
balance = (
|
||||
aml_rec.amount_currency if aml_rec.currency_id else aml_rec.balance
|
||||
@@ -275,9 +275,9 @@ class AccountBankStatementLine(models.Model):
|
||||
self.ensure_one()
|
||||
company_currency = self.journal_id.company_id.currency_id
|
||||
statement_currency = self.journal_id.currency_id or company_currency
|
||||
st_line_currency = self.currency_id or statement_currency
|
||||
st_line_currency = self.foreign_currency_id or statement_currency
|
||||
st_line_currency_rate = (
|
||||
self.currency_id and (self.amount_currency / self.amount) or False
|
||||
self.foreign_currency_id and (self.amount_currency / self.amount) or False
|
||||
)
|
||||
company = self.company_id
|
||||
|
||||
@@ -285,7 +285,7 @@ class AccountBankStatementLine(models.Model):
|
||||
aml_dict["amount_currency"] = aml_dict["debit"] - aml_dict["credit"]
|
||||
aml_dict["currency_id"] = st_line_currency.id
|
||||
if (
|
||||
self.currency_id
|
||||
self.foreign_currency_id
|
||||
and statement_currency.id == company_currency.id
|
||||
and st_line_currency_rate
|
||||
):
|
||||
@@ -297,7 +297,7 @@ class AccountBankStatementLine(models.Model):
|
||||
aml_dict["credit"] = company_currency.round(
|
||||
aml_dict["credit"] / st_line_currency_rate
|
||||
)
|
||||
elif self.currency_id and st_line_currency_rate:
|
||||
elif self.foreign_currency_id and st_line_currency_rate:
|
||||
# Statement is in foreign currency and the transaction is in
|
||||
# another one
|
||||
aml_dict["debit"] = statement_currency._convert(
|
||||
|
||||
Reference in New Issue
Block a user