[MIG] account_tax_balance: Migration to 18.0

This commit is contained in:
Borruso
2024-12-06 15:05:48 +01:00
parent c0bcd49525
commit 431f564398
6 changed files with 23 additions and 21 deletions

View File

@@ -6,7 +6,7 @@
{ {
"name": "Tax Balance", "name": "Tax Balance",
"summary": "Compute tax balances based on date range", "summary": "Compute tax balances based on date range",
"version": "17.0.1.0.0", "version": "18.0.1.0.0",
"development_status": "Mature", "development_status": "Mature",
"category": "Invoices & Payments", "category": "Invoices & Payments",
"website": "https://github.com/OCA/account-financial-reporting", "website": "https://github.com/OCA/account-financial-reporting",

View File

@@ -1,7 +1,7 @@
# Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com> # Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # 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): class AccountMove(models.Model):
@@ -10,12 +10,12 @@ class AccountMove(models.Model):
@api.model @api.model
def _selection_financial_type(self): def _selection_financial_type(self):
return [ return [
("other", _("Other")), ("other", self.env._("Other")),
("liquidity", _("Liquidity")), ("liquidity", self.env._("Liquidity")),
("receivable", _("Receivable")), ("receivable", self.env._("Receivable")),
("receivable_refund", _("Receivable refund")), ("receivable_refund", self.env._("Receivable refund")),
("payable", _("Payable")), ("payable", self.env._("Payable")),
("payable_refund", _("Payable refund")), ("payable_refund", self.env._("Payable refund")),
] ]
financial_type = fields.Selection( financial_type = fields.Selection(

View File

@@ -2,7 +2,7 @@
# Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com> # Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # 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): class AccountTax(models.Model):
@@ -77,7 +77,7 @@ class AccountTax(models.Model):
@api.model @api.model
def _search_has_moves(self, operator, value): def _search_has_moves(self, operator, value):
if self._is_unsupported_search_operator(operator) or not 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() ids_with_moves = self._account_tax_ids_with_moves()
return [("id", "in", ids_with_moves)] return [("id", "in", ids_with_moves)]

View File

@@ -10,7 +10,7 @@ from dateutil.rrule import MONTHLY
import odoo import odoo
from odoo import fields from odoo import fields
from odoo.fields import Date 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 from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@@ -40,8 +40,8 @@ class TestAccountTaxBalance(HttpCase):
cls.current_month = datetime.now().month cls.current_month = datetime.now().month
range_generator = cls.range_generator.create( range_generator = cls.range_generator.create(
{ {
"date_start": "%s-01-01" % cls.current_year, "date_start": f"{cls.current_year}-01-01",
"name_prefix": "%s-" % cls.current_year, "name_prefix": f"{cls.current_year}-",
"type_id": cls.range_type.id, "type_id": cls.range_type.id,
"duration_count": 1, "duration_count": 1,
"unit_of_time": str(MONTHLY), "unit_of_time": str(MONTHLY),
@@ -188,7 +188,7 @@ class TestAccountTaxBalance(HttpCase):
liquidity_account_id = self.env["account.account"].search( liquidity_account_id = self.env["account.account"].search(
[ [
("account_type", "in", ["asset_cash", "liability_credit_card"]), ("account_type", "in", ["asset_cash", "liability_credit_card"]),
("company_id", "=", self.company.id), ("company_ids", "in", self.company.id),
], ],
limit=1, limit=1,
) )

View File

@@ -4,11 +4,11 @@
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo> <odoo>
<record id="view_tax_tree_balance" model="ir.ui.view"> <record id="view_tax_tree_balance" model="ir.ui.view">
<field name="name">account.tax.tree.balance</field> <field name="name">account.tax.list.balance</field>
<field name="model">account.tax</field> <field name="model">account.tax</field>
<field eval="100" name="priority" /> <field eval="100" name="priority" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree create="false" delete="false"> <list create="false" delete="false">
<field name="name" /> <field name="name" />
<field name="description" string="Short Name" /> <field name="description" string="Short Name" />
<field name="balance_regular" sum="Total" /> <field name="balance_regular" sum="Total" />
@@ -53,7 +53,7 @@
title="View base lines" title="View base lines"
icon="fa-search-plus" icon="fa-search-plus"
/> />
</tree> </list>
</field> </field>
</record> </record>
<record id="view_tax_search_balance" model="ir.ui.view"> <record id="view_tax_search_balance" model="ir.ui.view">
@@ -85,7 +85,7 @@
<record id="action_tax_balances_tree" model="ir.actions.act_window"> <record id="action_tax_balances_tree" model="ir.actions.act_window">
<field name="name">Taxes Balance</field> <field name="name">Taxes Balance</field>
<field name="res_model">account.tax</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="domain">[('has_moves', '=', True)]</field>
<field name="view_id" ref="view_tax_tree_balance" /> <field name="view_id" ref="view_tax_tree_balance" />
<field name="search_view_id" ref="view_tax_search_balance" /> <field name="search_view_id" ref="view_tax_search_balance" />

View File

@@ -1,7 +1,7 @@
# Copyright 2016 Lorenzo Battistini - Agile Business Group # Copyright 2016 Lorenzo Battistini - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # 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): class WizardOpenTaxBalances(models.TransientModel):
@@ -64,12 +64,14 @@ class WizardOpenTaxBalances(models.TransientModel):
date_format = lang and lang.date_format or "%m/%d/%Y" date_format = lang and lang.date_format or "%m/%d/%Y"
infos = { infos = {
"name": vals["name"], "name": vals["name"],
"target": _(self.target_move), "target": self.env._(self.target_move),
"from": self.from_date.strftime(date_format), "from": self.from_date.strftime(date_format),
"to": self.to_date.strftime(date_format), "to": self.to_date.strftime(date_format),
} }
# name of action which is displayed in breacrumb # 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") multi_cpny_grp = self.env.ref("base.group_multi_company")
if multi_cpny_grp in self.env.user.groups_id: if multi_cpny_grp in self.env.user.groups_id:
company_names = self.company_ids.mapped("name") company_names = self.company_ids.mapped("name")