From 22d8d9b2fdf47c224e7443b9f928c1d3d5a1f460 Mon Sep 17 00:00:00 2001 From: rjaraspearhead Date: Fri, 6 Dec 2024 12:26:13 -0500 Subject: [PATCH] [MIG] : account_financial_risk Migration to 18.0 --- account_financial_risk/models/res_partner.py | 12 ++++++------ .../tests/test_account_financial_risk.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/account_financial_risk/models/res_partner.py b/account_financial_risk/models/res_partner.py index 3b22038d9..c50dea616 100644 --- a/account_financial_risk/models/res_partner.py +++ b/account_financial_risk/models/res_partner.py @@ -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, ) @@ -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, ) diff --git a/account_financial_risk/tests/test_account_financial_risk.py b/account_financial_risk/tests/test_account_financial_risk.py index 27277e1c2..8822e2385 100644 --- a/account_financial_risk/tests/test_account_financial_risk.py +++ b/account_financial_risk/tests/test_account_financial_risk.py @@ -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(