2
0

[MIG] account_template_active from 14.0 to 16.0

- use new web_ribbon widget to display archived items on form views
- change inheritance from account to account_usability regarding views that disappeared in V16
This commit is contained in:
Sylvain LE GAL 2022-11-03 23:25:22 +01:00
parent 004fb41965
commit da416248ac
12 changed files with 69 additions and 51 deletions

View File

@ -4,7 +4,7 @@
{ {
"name": "Disable Account Template Items", "name": "Disable Account Template Items",
"version": "14.0.1.0.0", "version": "16.0.1.0.0",
"category": "Accounting", "category": "Accounting",
"license": "AGPL-3", "license": "AGPL-3",
"summary": "Allow to disable / enable account template items" "summary": "Allow to disable / enable account template items"
@ -13,7 +13,7 @@
"maintainers": ["legalsylvain"], "maintainers": ["legalsylvain"],
"website": "https://github.com/OCA/account-financial-tools", "website": "https://github.com/OCA/account-financial-tools",
"depends": [ "depends": [
"account_menu", "account_usability",
], ],
"data": [ "data": [
"views/view_account_account_template.xml", "views/view_account_account_template.xml",

View File

@ -1,11 +1,13 @@
# Translation of Odoo Server. # Translation of Odoo Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * account_template_active # * account_template_active
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 14.0\n" "Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-03 22:54+0000\n"
"PO-Revision-Date: 2022-11-03 22:54+0000\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -27,30 +29,10 @@ msgid "Active"
msgstr "" msgstr ""
#. module: account_template_active #. module: account_template_active
#: model:ir.model.fields,field_description:account_template_active.field_account_account_template__display_name #: model_terms:ir.ui.view,arch_db:account_template_active.view_account_fiscal_position_template_form
#: model:ir.model.fields,field_description:account_template_active.field_account_fiscal_position_account_template__display_name #: model_terms:ir.ui.view,arch_db:account_template_active.view_account_tax_template_form
#: model:ir.model.fields,field_description:account_template_active.field_account_fiscal_position_tax_template__display_name #: model_terms:ir.ui.view,arch_db:account_template_active.view_account_template_form
#: model:ir.model.fields,field_description:account_template_active.field_account_fiscal_position_template__display_name msgid "Archived"
#: model:ir.model.fields,field_description:account_template_active.field_account_tax_template__display_name
msgid "Display Name"
msgstr ""
#. module: account_template_active
#: model:ir.model.fields,field_description:account_template_active.field_account_account_template__id
#: model:ir.model.fields,field_description:account_template_active.field_account_fiscal_position_account_template__id
#: model:ir.model.fields,field_description:account_template_active.field_account_fiscal_position_tax_template__id
#: model:ir.model.fields,field_description:account_template_active.field_account_fiscal_position_template__id
#: model:ir.model.fields,field_description:account_template_active.field_account_tax_template__id
msgid "ID"
msgstr ""
#. module: account_template_active
#: model:ir.model.fields,field_description:account_template_active.field_account_account_template____last_update
#: model:ir.model.fields,field_description:account_template_active.field_account_fiscal_position_account_template____last_update
#: model:ir.model.fields,field_description:account_template_active.field_account_fiscal_position_tax_template____last_update
#: model:ir.model.fields,field_description:account_template_active.field_account_fiscal_position_template____last_update
#: model:ir.model.fields,field_description:account_template_active.field_account_tax_template____last_update
msgid "Last Modified on"
msgstr "" msgstr ""
#. module: account_template_active #. module: account_template_active
@ -71,4 +53,4 @@ msgstr ""
#. module: account_template_active #. module: account_template_active
#: model:ir.model,name:account_template_active.model_account_tax_template #: model:ir.model,name:account_template_active.model_account_tax_template
msgid "Templates for Taxes" msgid "Templates for Taxes"
msgstr "" msgstr ""

View File

@ -4,11 +4,11 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 12.0\n" "Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-04 16:57+0000\n" "POT-Creation-Date: 2022-11-03 22:52+0000\n"
"PO-Revision-Date: 2020-05-04 16:57+0000\n" "PO-Revision-Date: 2022-11-03 22:52+0000\n"
"Last-Translator: <>\n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
@ -28,6 +28,13 @@ msgstr "Modèle de mapping de compte de position fiscale"
msgid "Active" msgid "Active"
msgstr "Actif" msgstr "Actif"
#. module: account_template_active
#: model_terms:ir.ui.view,arch_db:account_template_active.view_account_fiscal_position_template_form
#: model_terms:ir.ui.view,arch_db:account_template_active.view_account_tax_template_form
#: model_terms:ir.ui.view,arch_db:account_template_active.view_account_template_form
msgid "Archived"
msgstr "Archivé·e"
#. module: account_template_active #. module: account_template_active
#: model:ir.model,name:account_template_active.model_account_fiscal_position_tax_template #: model:ir.model,name:account_template_active.model_account_fiscal_position_tax_template
msgid "Tax Mapping Template of Fiscal Position" msgid "Tax Mapping Template of Fiscal Position"
@ -47,4 +54,3 @@ msgstr "Modèles pour les comptes"
#: model:ir.model,name:account_template_active.model_account_tax_template #: model:ir.model,name:account_template_active.model_account_tax_template
msgid "Templates for Taxes" msgid "Templates for Taxes"
msgstr "Modèles pour les taxes" msgstr "Modèles pour les taxes"

View File

@ -8,7 +8,7 @@ from odoo import fields, models
class AccountAccountTemplate(models.Model): class AccountAccountTemplate(models.Model):
_inherit = "account.account.template" _inherit = "account.account.template"
active = fields.Boolean(string="Active", default=True) active = fields.Boolean(default=True)
def write(self, vals): def write(self, vals):
FpaTemplate = self.env["account.fiscal.position.account.template"] FpaTemplate = self.env["account.fiscal.position.account.template"]

View File

@ -8,7 +8,7 @@ from odoo import fields, models
class AccountFiscalPositionAccountTemplate(models.Model): class AccountFiscalPositionAccountTemplate(models.Model):
_inherit = "account.fiscal.position.account.template" _inherit = "account.fiscal.position.account.template"
active = fields.Boolean("Active", default=True) active = fields.Boolean(default=True)
def write(self, vals): def write(self, vals):
AccountTemplate = self.env["account.account.template"] AccountTemplate = self.env["account.account.template"]

View File

@ -8,7 +8,7 @@ from odoo import fields, models
class AccountFiscalPositionTaxTemplate(models.Model): class AccountFiscalPositionTaxTemplate(models.Model):
_inherit = "account.fiscal.position.tax.template" _inherit = "account.fiscal.position.tax.template"
active = fields.Boolean("Active", default=True) active = fields.Boolean(default=True)
def write(self, vals): def write(self, vals):
TaxTemplate = self.env["account.tax.template"] TaxTemplate = self.env["account.tax.template"]

View File

@ -8,4 +8,4 @@ from odoo import fields, models
class AccountFiscalPositionTemplate(models.Model): class AccountFiscalPositionTemplate(models.Model):
_inherit = "account.fiscal.position.template" _inherit = "account.fiscal.position.template"
active = fields.Boolean("Active", default=True) active = fields.Boolean(default=True)

View File

@ -1,2 +1,2 @@
* Go to Configuration > Templates * Go to Accounting > Configuration > Templates
* Select then the template you want to change. * Select then the template you want to change.

View File

@ -15,8 +15,6 @@ class TestModule(TransactionCase):
self.AFPATemplate = self.env["account.fiscal.position.account.template"] self.AFPATemplate = self.env["account.fiscal.position.account.template"]
self.AFPTTemplate = self.env["account.fiscal.position.tax.template"] self.AFPTTemplate = self.env["account.fiscal.position.tax.template"]
self.receivable_type = self.env.ref("account.data_account_type_receivable")
self.template = self.ACTemplate.create( self.template = self.ACTemplate.create(
{ {
"name": "Chart of Account", "name": "Chart of Account",
@ -31,7 +29,7 @@ class TestModule(TransactionCase):
{ {
"name": "Account Template", "name": "Account Template",
"code": "CODE", "code": "CODE",
"user_type_id": self.receivable_type.id, "account_type": "asset_receivable",
"chart_template_id": self.template.id, "chart_template_id": self.template.id,
} }
) )

View File

@ -9,29 +9,43 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<record id="view_account_account_template_tree" model="ir.ui.view"> <record id="view_account_account_template_tree" model="ir.ui.view">
<field name="model">account.account.template</field> <field name="model">account.account.template</field>
<field name="inherit_id" ref="account.view_account_template_tree" /> <field
name="inherit_id"
ref="account_usability.view_account_account_template_tree"
/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//tree" position="attributes"> <xpath expr="//tree" position="attributes">
<attribute name="decoration-muted">not active</attribute> <attribute name="decoration-muted">not active</attribute>
</xpath> </xpath>
<field name="user_type_id" position="after"> <field name="account_type" position="after">
<field name="active" /> <field name="active" widget="boolean_toggle" />
</field> </field>
</field> </field>
</record> </record>
<record id="view_account_template_form" model="ir.ui.view"> <record id="view_account_template_form" model="ir.ui.view">
<field name="model">account.account.template</field> <field name="model">account.account.template</field>
<field name="inherit_id" ref="account.view_account_template_form" /> <field
name="inherit_id"
ref="account_usability.view_account_account_template_form"
/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='name']/.." position="before">
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs=" {'invisible': [('active', '=', True)]}"
/>
</xpath>
<field name="chart_template_id" position="after"> <field name="chart_template_id" position="after">
<field name="active" /> <field name="active" invisible="1" />
</field> </field>
</field> </field>
</record> </record>
<record <record
id="account_menu.account_account_template_action" id="account_usability.account_account_template_action"
model="ir.actions.act_window" model="ir.actions.act_window"
> >
<field name="context">{"active_test": False}</field> <field name="context">{"active_test": False}</field>

View File

@ -24,8 +24,16 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<field name="model">account.fiscal.position.template</field> <field name="model">account.fiscal.position.template</field>
<field name="inherit_id" ref="account.view_account_position_template_form" /> <field name="inherit_id" ref="account.view_account_position_template_form" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='name']/.." position="before">
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs=" {'invisible': [('active', '=', True)]}"
/>
</xpath>
<field name="chart_template_id" position="after"> <field name="chart_template_id" position="after">
<field name="active" /> <field name="active" invisible="1" />
</field> </field>
<xpath expr="//field[@name='tax_ids']/tree" position="attributes"> <xpath expr="//field[@name='tax_ids']/tree" position="attributes">
<attribute name="decoration-muted">not active</attribute> <attribute name="decoration-muted">not active</attribute>
@ -58,7 +66,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
</record> </record>
<record <record
id="account_menu.account_fiscal_position_template_action" id="account_usability.account_fiscal_position_template_action"
model="ir.actions.act_window" model="ir.actions.act_window"
> >
<field name="context">{"active_test": False}</field> <field name="context">{"active_test": False}</field>

View File

@ -18,15 +18,25 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
</field> </field>
</field> </field>
</record> </record>
<record id="view_account_tax_template_form" model="ir.ui.view"> <record id="view_account_tax_template_form" model="ir.ui.view">
<field name="model">account.tax.template</field> <field name="model">account.tax.template</field>
<field name="inherit_id" ref="account.view_account_tax_template_form" /> <field name="inherit_id" ref="account.view_account_tax_template_form" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<group name="main_group" position="before">
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs=" {'invisible': [('active', '=', True)]}"
/>
</group>
<field name="name" position="after"> <field name="name" position="after">
<field name="active" /> <field name="active" invisible="1" />
</field> </field>
</field> </field>
</record> </record>
<record id="account.action_account_tax_template_form" model="ir.actions.act_window"> <record id="account.action_account_tax_template_form" model="ir.actions.act_window">
<field name="context">{"active_test": False}</field> <field name="context">{"active_test": False}</field>
</record> </record>