2
0

[14.0][MIG] account_chart_update: Migration to 14.0

This commit is contained in:
Reyes4711 2021-03-08 17:25:04 +01:00 committed by Luis J. Salvatierra
parent 45096c56ef
commit d4094eff87
8 changed files with 105 additions and 21 deletions

View File

@ -14,13 +14,13 @@ Detect changes and update the Account Chart from a template
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-tools/tree/13.0/account_chart_update :target: https://github.com/OCA/account-financial-tools/tree/14.0/account_chart_update
:alt: OCA/account-financial-tools :alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_chart_update :target: https://translation.odoo-community.org/projects/account-financial-tools-14-0/account-financial-tools-14-0-account_chart_update
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/92/13.0 :target: https://runbot.odoo-community.org/runbot/92/14.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -69,7 +69,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_chart_update%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_chart_update%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@ -110,6 +110,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/13.0/account_chart_update>`_ project on GitHub. This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/14.0/account_chart_update>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -7,13 +7,14 @@
{ {
"name": "Detect changes and update the Account Chart from a template", "name": "Detect changes and update the Account Chart from a template",
"summary": "Wizard to update a company's account chart from a template", "summary": "Wizard to update a company's account chart from a template",
"version": "13.0.1.0.5", "version": "14.0.1.0.0",
"author": "Tecnativa, BCIM, Okia, Odoo Community Association (OCA)", "author": "Tecnativa, BCIM, Okia, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools", "website": "https://github.com/OCA/account-financial-tools",
"depends": ["account"], "depends": ["account"],
"category": "Accounting", "category": "Accounting",
"license": "AGPL-3", "license": "AGPL-3",
"data": [ "data": [
"security/ir.model.access.csv",
"wizard/wizard_chart_update_view.xml", "wizard/wizard_chart_update_view.xml",
"views/account_config_settings_view.xml", "views/account_config_settings_view.xml",
], ],

View File

@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 13.0\n" "Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@ -166,6 +166,7 @@ msgid "Differences in these fields: %s."
msgstr "" msgstr ""
#. module: account_chart_update #. module: account_chart_update
#: model:ir.model.fields,field_description:account_chart_update.field_ir_model_fields__display_name
#: model:ir.model.fields,field_description:account_chart_update.field_wizard_account_matching__display_name #: model:ir.model.fields,field_description:account_chart_update.field_wizard_account_matching__display_name
#: model:ir.model.fields,field_description:account_chart_update.field_wizard_fp_matching__display_name #: model:ir.model.fields,field_description:account_chart_update.field_wizard_fp_matching__display_name
#: model:ir.model.fields,field_description:account_chart_update.field_wizard_matching__display_name #: model:ir.model.fields,field_description:account_chart_update.field_wizard_matching__display_name
@ -273,6 +274,7 @@ msgid "Here you can set the matching order."
msgstr "" msgstr ""
#. module: account_chart_update #. module: account_chart_update
#: model:ir.model.fields,field_description:account_chart_update.field_ir_model_fields__id
#: model:ir.model.fields,field_description:account_chart_update.field_wizard_account_matching__id #: model:ir.model.fields,field_description:account_chart_update.field_wizard_account_matching__id
#: model:ir.model.fields,field_description:account_chart_update.field_wizard_fp_matching__id #: model:ir.model.fields,field_description:account_chart_update.field_wizard_fp_matching__id
#: model:ir.model.fields,field_description:account_chart_update.field_wizard_matching__id #: model:ir.model.fields,field_description:account_chart_update.field_wizard_matching__id
@ -310,6 +312,7 @@ msgid "Language"
msgstr "" msgstr ""
#. module: account_chart_update #. module: account_chart_update
#: model:ir.model.fields,field_description:account_chart_update.field_ir_model_fields____last_update
#: model:ir.model.fields,field_description:account_chart_update.field_wizard_account_matching____last_update #: model:ir.model.fields,field_description:account_chart_update.field_wizard_account_matching____last_update
#: model:ir.model.fields,field_description:account_chart_update.field_wizard_fp_matching____last_update #: model:ir.model.fields,field_description:account_chart_update.field_wizard_fp_matching____last_update
#: model:ir.model.fields,field_description:account_chart_update.field_wizard_matching____last_update #: model:ir.model.fields,field_description:account_chart_update.field_wizard_matching____last_update
@ -470,6 +473,9 @@ msgstr ""
#. module: account_chart_update #. module: account_chart_update
#: model:ir.model.fields,field_description:account_chart_update.field_wizard_update_charts_accounts__recreate_xml_ids #: model:ir.model.fields,field_description:account_chart_update.field_wizard_update_charts_accounts__recreate_xml_ids
#: model:ir.model.fields,field_description:account_chart_update.field_wizard_update_charts_accounts_account__recreate_xml_ids
#: model:ir.model.fields,field_description:account_chart_update.field_wizard_update_charts_accounts_fiscal_position__recreate_xml_ids
#: model:ir.model.fields,field_description:account_chart_update.field_wizard_update_charts_accounts_tax__recreate_xml_ids
msgid "Recreate missing XML-IDs" msgid "Recreate missing XML-IDs"
msgstr "" msgstr ""
@ -513,7 +519,7 @@ msgstr ""
#. module: account_chart_update #. module: account_chart_update
#: model:ir.model.fields,field_description:account_chart_update.field_wizard_update_charts_accounts_tax__type_tax_use #: model:ir.model.fields,field_description:account_chart_update.field_wizard_update_charts_accounts_tax__type_tax_use
msgid "Tax Scope" msgid "Tax Type"
msgstr "" msgstr ""
#. module: account_chart_update #. module: account_chart_update

View File

@ -0,0 +1,9 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_wizard_update_charts_accounts,wizard.update.charts.accounts,model_wizard_update_charts_accounts,,1,1,1,1
access_wizard_update_charts_accounts_account,wizard.update.charts.accounts.account,model_wizard_update_charts_accounts_account,,1,1,1,1
access_wizard_tax_matching,wizard.tax.matching,model_wizard_tax_matching,,1,1,1,1
access_wizard_fp_matching,wizard.fp.matching,model_wizard_fp_matching,,1,1,1,1
access_wizard_account_matching,wizard.account.matching,model_wizard_account_matching,,1,1,1,1
access_wizard_update_charts_accounts_tax,wizard.update.charts.accounts.tax,model_wizard_update_charts_accounts_tax,,1,1,1,1
access_wizard_matching,wizard.matching,model_wizard_matching,,1,1,1,1
access_wizard_update_charts_accounts_fiscal_position,wizard.update.charts.accounts.fiscal.position,model_wizard_update_charts_accounts_fiscal_position,,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_wizard_update_charts_accounts wizard.update.charts.accounts model_wizard_update_charts_accounts 1 1 1 1
3 access_wizard_update_charts_accounts_account wizard.update.charts.accounts.account model_wizard_update_charts_accounts_account 1 1 1 1
4 access_wizard_tax_matching wizard.tax.matching model_wizard_tax_matching 1 1 1 1
5 access_wizard_fp_matching wizard.fp.matching model_wizard_fp_matching 1 1 1 1
6 access_wizard_account_matching wizard.account.matching model_wizard_account_matching 1 1 1 1
7 access_wizard_update_charts_accounts_tax wizard.update.charts.accounts.tax model_wizard_update_charts_accounts_tax 1 1 1 1
8 access_wizard_matching wizard.matching model_wizard_matching 1 1 1 1
9 access_wizard_update_charts_accounts_fiscal_position wizard.update.charts.accounts.fiscal.position model_wizard_update_charts_accounts_fiscal_position 1 1 1 1

View File

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/13.0/account_chart_update"><img alt="OCA/account-financial-tools" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_chart_update"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/92/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/14.0/account_chart_update"><img alt="OCA/account-financial-tools" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-tools-14-0/account-financial-tools-14-0-account_chart_update"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/92/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This is a pretty useful tool to update Odoo installations after tax reforms <p>This is a pretty useful tool to update Odoo installations after tax reforms
on the official charts of accounts, or to apply fixes performed on the chart on the official charts of accounts, or to apply fixes performed on the chart
template.</p> template.</p>
@ -418,7 +418,7 @@ deactivate).</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-tools/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-tools/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_chart_update%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_chart_update%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -453,7 +453,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/13.0/account_chart_update">OCA/account-financial-tools</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/14.0/account_chart_update">OCA/account-financial-tools</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@ -126,7 +126,7 @@ class TestAccountChartUpdate(common.HttpCase):
) )
company_user = self.env.user.copy({"company_id": self.company.id}) company_user = self.env.user.copy({"company_id": self.company.id})
chart_by_company_user = self.chart_template.with_user(company_user) chart_by_company_user = self.chart_template.with_user(company_user)
chart_by_company_user.try_loading_for_current_company() chart_by_company_user.try_loading()
self.tax = self.env["account.tax"].search( self.tax = self.env["account.tax"].search(
[ [
@ -324,7 +324,7 @@ class TestAccountChartUpdate(common.HttpCase):
self.env["account.move"].create( self.env["account.move"].create(
{ {
"name": "Test move", "name": "Test move",
"type": "entry", "move_type": "entry",
"journal_id": self.env["account.journal"] "journal_id": self.env["account.journal"]
.search([("company_id", "=", self.company.id)], limit=1) .search([("company_id", "=", self.company.id)], limit=1)
.id, .id,

View File

@ -55,7 +55,6 @@ class WizardUpdateChartsAccounts(models.TransientModel):
lang = fields.Selection( lang = fields.Selection(
lambda self: self._get_lang_selection_options(), lambda self: self._get_lang_selection_options(),
"Language", "Language",
size=5,
required=True, required=True,
help="For records searched by name (taxes, fiscal " help="For records searched by name (taxes, fiscal "
"positions), the template name will be matched against the " "positions), the template name will be matched against the "
@ -87,7 +86,6 @@ class WizardUpdateChartsAccounts(models.TransientModel):
recreate_xml_ids = fields.Boolean(string="Recreate missing XML-IDs") recreate_xml_ids = fields.Boolean(string="Recreate missing XML-IDs")
tax_ids = fields.One2many( tax_ids = fields.One2many(
comodel_name="wizard.update.charts.accounts.tax", comodel_name="wizard.update.charts.accounts.tax",
ondelete="cascade",
inverse_name="update_chart_wizard_id", inverse_name="update_chart_wizard_id",
string="Taxes", string="Taxes",
) )
@ -95,13 +93,11 @@ class WizardUpdateChartsAccounts(models.TransientModel):
comodel_name="wizard.update.charts.accounts.account", comodel_name="wizard.update.charts.accounts.account",
inverse_name="update_chart_wizard_id", inverse_name="update_chart_wizard_id",
string="Accounts", string="Accounts",
ondelete="cascade",
) )
fiscal_position_ids = fields.One2many( fiscal_position_ids = fields.One2many(
comodel_name="wizard.update.charts.accounts.fiscal.position", comodel_name="wizard.update.charts.accounts.fiscal.position",
inverse_name="update_chart_wizard_id", inverse_name="update_chart_wizard_id",
string="Fiscal positions", string="Fiscal positions",
ondelete="cascade",
) )
new_taxes = fields.Integer(string="New taxes", compute="_compute_new_taxes_count") new_taxes = fields.Integer(string="New taxes", compute="_compute_new_taxes_count")
new_accounts = fields.Integer( new_accounts = fields.Integer(
@ -1101,7 +1097,7 @@ class WizardUpdateChartsAccountsTax(models.TransientModel):
("deleted", "Tax to deactivate"), ("deleted", "Tax to deactivate"),
], ],
string="Type", string="Type",
readonly=True, readonly=False,
) )
type_tax_use = fields.Selection(related="tax_id.type_tax_use", readonly=True) type_tax_use = fields.Selection(related="tax_id.type_tax_use", readonly=True)
update_tax_id = fields.Many2one( update_tax_id = fields.Many2one(
@ -1111,6 +1107,10 @@ class WizardUpdateChartsAccountsTax(models.TransientModel):
ondelete="set null", ondelete="set null",
) )
notes = fields.Text("Notes", readonly=True) notes = fields.Text("Notes", readonly=True)
recreate_xml_ids = fields.Boolean(
string="Recreate missing XML-IDs",
related="update_chart_wizard_id.recreate_xml_ids",
)
class WizardUpdateChartsAccountsAccount(models.TransientModel): class WizardUpdateChartsAccountsAccount(models.TransientModel):
@ -1133,7 +1133,7 @@ class WizardUpdateChartsAccountsAccount(models.TransientModel):
type = fields.Selection( type = fields.Selection(
selection=[("new", "New template"), ("updated", "Updated template")], selection=[("new", "New template"), ("updated", "Updated template")],
string="Type", string="Type",
readonly=True, readonly=False,
) )
update_account_id = fields.Many2one( update_account_id = fields.Many2one(
comodel_name="account.account", comodel_name="account.account",
@ -1142,6 +1142,10 @@ class WizardUpdateChartsAccountsAccount(models.TransientModel):
ondelete="set null", ondelete="set null",
) )
notes = fields.Text("Notes", readonly=True) notes = fields.Text("Notes", readonly=True)
recreate_xml_ids = fields.Boolean(
string="Recreate missing XML-IDs",
related="update_chart_wizard_id.recreate_xml_ids",
)
class WizardUpdateChartsAccountsFiscalPosition(models.TransientModel): class WizardUpdateChartsAccountsFiscalPosition(models.TransientModel):
@ -1164,8 +1168,7 @@ class WizardUpdateChartsAccountsFiscalPosition(models.TransientModel):
type = fields.Selection( type = fields.Selection(
selection=[("new", "New template"), ("updated", "Updated template")], selection=[("new", "New template"), ("updated", "Updated template")],
string="Type", string="Type",
readonly=True, readonly=False,
required=True,
) )
update_fiscal_position_id = fields.Many2one( update_fiscal_position_id = fields.Many2one(
comodel_name="account.fiscal.position", comodel_name="account.fiscal.position",
@ -1174,6 +1177,10 @@ class WizardUpdateChartsAccountsFiscalPosition(models.TransientModel):
ondelete="set null", ondelete="set null",
) )
notes = fields.Text("Notes", readonly=True) notes = fields.Text("Notes", readonly=True)
recreate_xml_ids = fields.Boolean(
string="Recreate missing XML-IDs",
related="update_chart_wizard_id.recreate_xml_ids",
)
class WizardMatching(models.TransientModel): class WizardMatching(models.TransientModel):

View File

@ -211,6 +211,27 @@
<field name="notes" /> <field name="notes" />
<field name="type" /> <field name="type" />
</tree> </tree>
<form>
<group col="2">
<group>
<field
name="recreate_xml_ids"
invisible="1"
/>
<field name="tax_id" />
<field
name="type"
attrs="{'readonly': [('recreate_xml_ids','=', False)]}"
/>
<field name="notes" />
</group>
<group>
<field name="update_chart_wizard_id" />
<field name="type_tax_use" />
<field name="update_tax_id" />
</group>
</group>
</form>
</field> </field>
</page> </page>
<page <page
@ -224,6 +245,26 @@
<field name="notes" /> <field name="notes" />
<field name="type" /> <field name="type" />
</tree> </tree>
<form>
<group col="2">
<group>
<field
name="recreate_xml_ids"
invisible="1"
/>
<field name="account_id" />
<field
name="type"
attrs="{'readonly': [('recreate_xml_ids','=', False)]}"
/>
<field name="notes" />
</group>
<group>
<field name="update_chart_wizard_id" />
<field name="update_account_id" />
</group>
</group>
</form>
</field> </field>
</page> </page>
<page <page
@ -240,6 +281,26 @@
<field name="notes" /> <field name="notes" />
<field name="type" /> <field name="type" />
</tree> </tree>
<form>
<group col="2">
<group>
<field
name="recreate_xml_ids"
invisible="1"
/>
<field name="fiscal_position_id" />
<field
name="type"
attrs="{'readonly': [('recreate_xml_ids','=', False)]}"
/>
<field name="notes" />
</group>
<group>
<field name="update_chart_wizard_id" />
<field name="update_fiscal_position_id" />
</group>
</group>
</form>
</field> </field>
</page> </page>
</notebook> </notebook>