Skip to content

Commit

Permalink
[MIG] account_tax_balance: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Borruso authored and OCA-git-bot committed Jan 31, 2025
1 parent 6bc2e1a commit e65233f
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion account_tax_balance/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions account_tax_balance/models/account_move.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# 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):
Expand All @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions account_tax_balance/models/account_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# 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):
Expand Down Expand Up @@ -77,7 +77,7 @@ def _is_unsupported_search_operator(self, operator):
@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"))

Check warning on line 80 in account_tax_balance/models/account_tax.py

View check run for this annotation

Codecov / codecov/patch

account_tax_balance/models/account_tax.py#L80

Added line #L80 was not covered by tests
ids_with_moves = self._account_tax_ids_with_moves()
return [("id", "in", ids_with_moves)]

Expand Down
8 changes: 4 additions & 4 deletions account_tax_balance/tests/test_account_tax_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
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

Expand Down Expand Up @@ -40,8 +40,8 @@ def setUpClass(cls):
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),
Expand Down Expand Up @@ -188,7 +188,7 @@ def test_tax_balance(self):
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,
)
Expand Down
2 changes: 1 addition & 1 deletion account_tax_balance/views/account_move_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_move_tree" model="ir.ui.view">
<record id="view_move_list" model="ir.ui.view">
<field name="name">Add move type column</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_tree" />
Expand Down
14 changes: 7 additions & 7 deletions account_tax_balance/views/account_tax_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_tax_tree_balance" model="ir.ui.view">
<field name="name">account.tax.tree.balance</field>
<record id="view_tax_list_balance" model="ir.ui.view">
<field name="name">account.tax.list.balance</field>
<field name="model">account.tax</field>
<field eval="100" name="priority" />
<field name="arch" type="xml">
<tree create="false" delete="false">
<list create="false" delete="false">
<field name="name" />
<field name="description" string="Short Name" />
<field name="balance_regular" sum="Total" />
Expand Down Expand Up @@ -53,7 +53,7 @@
title="View base lines"
icon="fa-search-plus"
/>
</tree>
</list>
</field>
</record>
<record id="view_tax_search_balance" model="ir.ui.view">
Expand Down Expand Up @@ -82,12 +82,12 @@
</search>
</field>
</record>
<record id="action_tax_balances_tree" model="ir.actions.act_window">
<record id="action_tax_balances_list" model="ir.actions.act_window">
<field name="name">Taxes Balance</field>
<field name="res_model">account.tax</field>
<field name="view_mode">tree</field>
<field name="view_mode">list</field>
<field name="domain">[('has_moves', '=', True)]</field>
<field name="view_id" ref="view_tax_tree_balance" />
<field name="view_id" ref="view_tax_list_balance" />
<field name="search_view_id" ref="view_tax_search_balance" />
</record>
</odoo>
10 changes: 6 additions & 4 deletions account_tax_balance/wizard/open_tax_balances.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -40,7 +40,7 @@ def _compute_date_range(self):

def open_taxes(self):
self.ensure_one()
action = self.env.ref("account_tax_balance.action_tax_balances_tree")
action = self.env.ref("account_tax_balance.action_tax_balances_list")
act_vals = action.sudo().read()[0]
# override action name doesn't work in v12 or v10
# we need to build a dynamic action on main keys
Expand All @@ -64,12 +64,14 @@ def open_taxes(self):
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")
Expand Down

0 comments on commit e65233f

Please sign in to comment.