From 431f564398d736b51776afac506c4e61e458ff4f Mon Sep 17 00:00:00 2001 From: Borruso Date: Fri, 6 Dec 2024 15:05:48 +0100 Subject: [PATCH] [MIG] account_tax_balance: Migration to 18.0 --- account_tax_balance/__manifest__.py | 2 +- account_tax_balance/models/account_move.py | 14 +++++++------- account_tax_balance/models/account_tax.py | 4 ++-- .../tests/test_account_tax_balance.py | 8 ++++---- account_tax_balance/views/account_tax_view.xml | 8 ++++---- account_tax_balance/wizard/open_tax_balances.py | 8 +++++--- 6 files changed, 23 insertions(+), 21 deletions(-) diff --git a/account_tax_balance/__manifest__.py b/account_tax_balance/__manifest__.py index 164110e0..934dcb49 100644 --- a/account_tax_balance/__manifest__.py +++ b/account_tax_balance/__manifest__.py @@ -6,7 +6,7 @@ { "name": "Tax Balance", "summary": "Compute tax balances based on date range", - "version": "17.0.1.0.0", + "version": "18.0.1.0.0", "development_status": "Mature", "category": "Invoices & Payments", "website": "https://github.com/OCA/account-financial-reporting", diff --git a/account_tax_balance/models/account_move.py b/account_tax_balance/models/account_move.py index 82bf0fb5..26758f81 100644 --- a/account_tax_balance/models/account_move.py +++ b/account_tax_balance/models/account_move.py @@ -1,7 +1,7 @@ # Copyright 2016 Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import api, fields, models class AccountMove(models.Model): @@ -10,12 +10,12 @@ class AccountMove(models.Model): @api.model def _selection_financial_type(self): return [ - ("other", _("Other")), - ("liquidity", _("Liquidity")), - ("receivable", _("Receivable")), - ("receivable_refund", _("Receivable refund")), - ("payable", _("Payable")), - ("payable_refund", _("Payable refund")), + ("other", self.env._("Other")), + ("liquidity", self.env._("Liquidity")), + ("receivable", self.env._("Receivable")), + ("receivable_refund", self.env._("Receivable refund")), + ("payable", self.env._("Payable")), + ("payable_refund", self.env._("Payable refund")), ] financial_type = fields.Selection( diff --git a/account_tax_balance/models/account_tax.py b/account_tax_balance/models/account_tax.py index 6eadace4..3cf7b4f9 100644 --- a/account_tax_balance/models/account_tax.py +++ b/account_tax_balance/models/account_tax.py @@ -2,7 +2,7 @@ # Copyright 2016 Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import api, fields, models class AccountTax(models.Model): @@ -77,7 +77,7 @@ class AccountTax(models.Model): @api.model def _search_has_moves(self, operator, value): if self._is_unsupported_search_operator(operator) or not value: - raise ValueError(_("Unsupported search operator")) + raise ValueError(self.env._("Unsupported search operator")) ids_with_moves = self._account_tax_ids_with_moves() return [("id", "in", ids_with_moves)] diff --git a/account_tax_balance/tests/test_account_tax_balance.py b/account_tax_balance/tests/test_account_tax_balance.py index 7943015b..a2e2b245 100644 --- a/account_tax_balance/tests/test_account_tax_balance.py +++ b/account_tax_balance/tests/test_account_tax_balance.py @@ -10,7 +10,7 @@ from dateutil.rrule import MONTHLY import odoo from odoo import fields from odoo.fields import Date -from odoo.tests.common import Form, HttpCase +from odoo.tests import Form, HttpCase from odoo.addons.account.tests.common import AccountTestInvoicingCommon @@ -40,8 +40,8 @@ class TestAccountTaxBalance(HttpCase): cls.current_month = datetime.now().month range_generator = cls.range_generator.create( { - "date_start": "%s-01-01" % cls.current_year, - "name_prefix": "%s-" % cls.current_year, + "date_start": f"{cls.current_year}-01-01", + "name_prefix": f"{cls.current_year}-", "type_id": cls.range_type.id, "duration_count": 1, "unit_of_time": str(MONTHLY), @@ -188,7 +188,7 @@ class TestAccountTaxBalance(HttpCase): liquidity_account_id = self.env["account.account"].search( [ ("account_type", "in", ["asset_cash", "liability_credit_card"]), - ("company_id", "=", self.company.id), + ("company_ids", "in", self.company.id), ], limit=1, ) diff --git a/account_tax_balance/views/account_tax_view.xml b/account_tax_balance/views/account_tax_view.xml index 53780eee..8bc10381 100644 --- a/account_tax_balance/views/account_tax_view.xml +++ b/account_tax_balance/views/account_tax_view.xml @@ -4,11 +4,11 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> - account.tax.tree.balance + account.tax.list.balance account.tax - + @@ -53,7 +53,7 @@ title="View base lines" icon="fa-search-plus" /> - + @@ -85,7 +85,7 @@ Taxes Balance account.tax - tree + list [('has_moves', '=', True)] diff --git a/account_tax_balance/wizard/open_tax_balances.py b/account_tax_balance/wizard/open_tax_balances.py index a878959a..04121669 100644 --- a/account_tax_balance/wizard/open_tax_balances.py +++ b/account_tax_balance/wizard/open_tax_balances.py @@ -1,7 +1,7 @@ # Copyright 2016 Lorenzo Battistini - Agile Business Group # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import api, fields, models class WizardOpenTaxBalances(models.TransientModel): @@ -64,12 +64,14 @@ class WizardOpenTaxBalances(models.TransientModel): date_format = lang and lang.date_format or "%m/%d/%Y" infos = { "name": vals["name"], - "target": _(self.target_move), + "target": self.env._(self.target_move), "from": self.from_date.strftime(date_format), "to": self.to_date.strftime(date_format), } # name of action which is displayed in breacrumb - vals["name"] = _("%(name)s: %(target)s from %(from)s to %(to)s") % infos + vals["name"] = ( + self.env._("%(name)s: %(target)s from %(from)s to %(to)s") % infos + ) multi_cpny_grp = self.env.ref("base.group_multi_company") if multi_cpny_grp in self.env.user.groups_id: company_names = self.company_ids.mapped("name")