Skip to content

Commit

Permalink
[MIG] : account_financial_risk Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rjaraspearhead committed Dec 8, 2024
1 parent 9b10194 commit 22d8d9b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions account_financial_risk/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,17 +367,17 @@ def _prepare_risk_account_vals(self, groups):
# Partner receivable account determines if amount is in invoice field
for (
partner,
account,
_account,
currency, # noqa: B007
amount_residual,
amount_residual_currency, # noqa: B007
) in groups["draft"]["read_group"]:
if partner.id not in self.ids:
continue # pragma: no cover
vals["risk_invoice_draft"] += account.company_id.currency_id._convert(
vals["risk_invoice_draft"] += currency._convert(
amount_residual,
self.risk_currency_id,
account.company_id,
self.env.company,
fields.Date.context_today(self),
round=False,
)
Expand Down Expand Up @@ -420,16 +420,16 @@ def _prepare_risk_account_vals(self, groups):
def _get_amount_in_risk_currency(
self, currency, amount_residual_currency, amount_residual, account
):
acc_currency_id = account.company_id.currency_id.id
acc_currency_id = currency.id
risk_currency_id = self.risk_currency_id.id
if currency.id == risk_currency_id:
return amount_residual_currency
elif acc_currency_id == risk_currency_id:
return amount_residual
return account.company_id.currency_id._convert(
return currency._convert(
amount_residual,
self.risk_currency_id,
account.company_id,
self.env.company,
fields.Date.context_today(self),
round=False,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def setUpClass(cls):
"name": "Partner test",
"customer_rank": 1,
"property_account_receivable_id": cls.account_customer.id,
"company_id": cls.account_customer.company_id.id,
"company_id": cls.account_customer.company_ids[0].id,
}
)
cls.invoice_address = cls.env["res.partner"].create(
Expand Down

0 comments on commit 22d8d9b

Please sign in to comment.