[MIG] account_chart_update: Migration to 16.0
This commit is contained in:
parent
663cb7e096
commit
e5151026a5
@ -14,16 +14,16 @@ 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/15.0/account_chart_update
|
:target: https://github.com/OCA/account-financial-tools/tree/16.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-15-0/account-financial-tools-15-0-account_chart_update
|
:target: https://translation.odoo-community.org/projects/account-financial-tools-15-0/account-financial-tools-15-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/15.0
|
:target: https://runbot.odoo-community.org/runbot/92/16.0
|
||||||
:alt: Try me on Runbot
|
:alt: Try me on Runbot
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
|
||||||
This is a pretty useful tool to update Odoo installations after tax reforms
|
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
|
||||||
@ -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:%2015.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:%2016.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.
|
||||||
|
|
||||||
@ -97,6 +97,9 @@ Contributors
|
|||||||
* Alberto Martín - Guadaltech <alberto.martin@guadaltech.es>
|
* Alberto Martín - Guadaltech <alberto.martin@guadaltech.es>
|
||||||
* Fernando La Chica - GreenIce <fernandolachica@gmail.com>
|
* Fernando La Chica - GreenIce <fernandolachica@gmail.com>
|
||||||
* Jairo Llopis (https://www.moduon.team/)
|
* Jairo Llopis (https://www.moduon.team/)
|
||||||
|
* `Factor Libre <https://factorlibre.com>`_:
|
||||||
|
|
||||||
|
* Luis J. Salvatierra
|
||||||
|
|
||||||
Maintainers
|
Maintainers
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
@ -111,6 +114,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/15.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/16.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.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
{
|
{
|
||||||
"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": "15.0.1.2.0",
|
"version": "16.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", "l10n_generic_coa"],
|
"depends": ["account", "l10n_generic_coa"],
|
||||||
|
@ -9,3 +9,6 @@
|
|||||||
* Alberto Martín - Guadaltech <alberto.martin@guadaltech.es>
|
* Alberto Martín - Guadaltech <alberto.martin@guadaltech.es>
|
||||||
* Fernando La Chica - GreenIce <fernandolachica@gmail.com>
|
* Fernando La Chica - GreenIce <fernandolachica@gmail.com>
|
||||||
* Jairo Llopis (https://www.moduon.team/)
|
* Jairo Llopis (https://www.moduon.team/)
|
||||||
|
* `Factor Libre <https://factorlibre.com>`_:
|
||||||
|
|
||||||
|
* Luis J. Salvatierra
|
||||||
|
@ -23,12 +23,12 @@ class TestAccountChartUpdate(common.HttpCase):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def _create_account_tmpl(self, name, code, user_type, chart_template):
|
def _create_account_tmpl(self, name, code, account_type, chart_template):
|
||||||
record = self.env["account.account.template"].create(
|
record = self.env["account.account.template"].create(
|
||||||
{
|
{
|
||||||
"name": name,
|
"name": name,
|
||||||
"code": code,
|
"code": code,
|
||||||
"user_type_id": user_type.id,
|
"account_type": account_type,
|
||||||
"chart_template_id": chart_template and chart_template.id,
|
"chart_template_id": chart_template and chart_template.id,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -118,26 +118,19 @@ class TestAccountChartUpdate(common.HttpCase):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.account_type = self.env["account.account.type"].create(
|
|
||||||
{
|
|
||||||
"name": "Test account_chart_update account type",
|
|
||||||
"internal_group": "income",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
self.account_template = self._create_account_tmpl(
|
self.account_template = self._create_account_tmpl(
|
||||||
"Test", "100000", self.account_type, False
|
"Test", "100000", "income", False
|
||||||
)
|
)
|
||||||
self.chart_template = self.env.ref(
|
self.chart_template = self.env.ref(
|
||||||
"l10n_generic_coa.configurable_chart_template"
|
"l10n_generic_coa.configurable_chart_template"
|
||||||
)
|
)
|
||||||
# Avoid re-creating taxes.
|
# Avoid re-creating taxes.
|
||||||
# If false, the taxes that are created will be overwrited.
|
# If false, the taxes that are created will be overwrited.
|
||||||
self.chart_template.complete_tax_set = True
|
|
||||||
self.account_template.chart_template_id = self.chart_template.id
|
self.account_template.chart_template_id = self.chart_template.id
|
||||||
self.account_template_pl = self._create_account_tmpl(
|
self.account_template_pl = self._create_account_tmpl(
|
||||||
"Undistributed Profits/Losses",
|
"Undistributed Profits/Losses",
|
||||||
"999999",
|
"999999",
|
||||||
self.env.ref("account.data_unaffected_earnings"),
|
"equity",
|
||||||
self.chart_template,
|
self.chart_template,
|
||||||
)
|
)
|
||||||
self.tax_template = self._create_tax_tmpl("Test tax", self.chart_template)
|
self.tax_template = self._create_tax_tmpl("Test tax", self.chart_template)
|
||||||
@ -236,7 +229,7 @@ class TestAccountChartUpdate(common.HttpCase):
|
|||||||
{"tag_ids": [(6, 0, self.account_tag_1.ids)]}
|
{"tag_ids": [(6, 0, self.account_tag_1.ids)]}
|
||||||
)
|
)
|
||||||
new_account_tmpl = self._create_account_tmpl(
|
new_account_tmpl = self._create_account_tmpl(
|
||||||
"Test account 2", "333333", self.account_type, self.chart_template
|
"Test account 2", "333333", "income", self.chart_template
|
||||||
)
|
)
|
||||||
new_fp = self._create_fp_tmpl("Test fp 2", self.chart_template)
|
new_fp = self._create_fp_tmpl("Test fp 2", self.chart_template)
|
||||||
fp_template_tax = self.env["account.fiscal.position.tax.template"].create(
|
fp_template_tax = self.env["account.fiscal.position.tax.template"].create(
|
||||||
@ -450,7 +443,7 @@ class TestAccountChartUpdate(common.HttpCase):
|
|||||||
# Errors on account_creation
|
# Errors on account_creation
|
||||||
self.account_template.currency_id = False
|
self.account_template.currency_id = False
|
||||||
new_account_tmpl_2 = self._create_account_tmpl(
|
new_account_tmpl_2 = self._create_account_tmpl(
|
||||||
"Test account 3", "444444", self.account_type, self.chart_template
|
"Test account 3", "444444", "income", self.chart_template
|
||||||
)
|
)
|
||||||
wizard = self.wizard_obj.create(self.wizard_vals)
|
wizard = self.wizard_obj.create(self.wizard_vals)
|
||||||
wizard.action_find_records()
|
wizard.action_find_records()
|
||||||
@ -543,9 +536,9 @@ class TestAccountChartUpdate(common.HttpCase):
|
|||||||
wizard.fiscal_position_ids.fiscal_position_id, self.fp_template
|
wizard.fiscal_position_ids.fiscal_position_id, self.fp_template
|
||||||
)
|
)
|
||||||
# There is no XML-ID
|
# There is no XML-ID
|
||||||
self.assertFalse(list(self.tax.get_xml_id().values())[0])
|
self.assertFalse(list(self.tax.get_external_id().values())[0])
|
||||||
self.assertFalse(list(self.account.get_xml_id().values())[0])
|
self.assertFalse(list(self.account.get_external_id().values())[0])
|
||||||
self.assertFalse(list(self.fp.get_xml_id().values())[0])
|
self.assertFalse(list(self.fp.get_external_id().values())[0])
|
||||||
# Update for recreating XML-ID
|
# Update for recreating XML-ID
|
||||||
wizard.action_update_records()
|
wizard.action_update_records()
|
||||||
self.assertEqual(wizard.updated_taxes, 1)
|
self.assertEqual(wizard.updated_taxes, 1)
|
||||||
@ -555,9 +548,9 @@ class TestAccountChartUpdate(common.HttpCase):
|
|||||||
self.assertEqual(self.account.name, self.account_template.name)
|
self.assertEqual(self.account.name, self.account_template.name)
|
||||||
self.assertEqual(self.fp.note, self.fp_template.note)
|
self.assertEqual(self.fp.note, self.fp_template.note)
|
||||||
# There is XML-ID now
|
# There is XML-ID now
|
||||||
self.assertTrue(list(self.tax.get_xml_id().values())[0])
|
self.assertTrue(list(self.tax.get_external_id().values())[0])
|
||||||
self.assertTrue(list(self.account.get_xml_id().values())[0])
|
self.assertTrue(list(self.account.get_external_id().values())[0])
|
||||||
self.assertTrue(list(self.fp.get_xml_id().values())[0])
|
self.assertTrue(list(self.fp.get_external_id().values())[0])
|
||||||
wizard.unlink()
|
wizard.unlink()
|
||||||
|
|
||||||
# Test 2 recreate XML-ID
|
# Test 2 recreate XML-ID
|
||||||
@ -575,16 +568,16 @@ class TestAccountChartUpdate(common.HttpCase):
|
|||||||
wizard.fiscal_position_ids.fiscal_position_id, self.fp_template
|
wizard.fiscal_position_ids.fiscal_position_id, self.fp_template
|
||||||
)
|
)
|
||||||
# There is no XML-ID
|
# There is no XML-ID
|
||||||
self.assertFalse(list(self.tax.get_xml_id().values())[0])
|
self.assertFalse(list(self.tax.get_external_id().values())[0])
|
||||||
self.assertFalse(list(self.account.get_xml_id().values())[0])
|
self.assertFalse(list(self.account.get_external_id().values())[0])
|
||||||
self.assertFalse(list(self.fp.get_xml_id().values())[0])
|
self.assertFalse(list(self.fp.get_external_id().values())[0])
|
||||||
# Update for recreating XML-ID
|
# Update for recreating XML-ID
|
||||||
wizard.action_update_records()
|
wizard.action_update_records()
|
||||||
self.assertEqual(wizard.updated_taxes, 1)
|
self.assertEqual(wizard.updated_taxes, 1)
|
||||||
self.assertEqual(wizard.updated_accounts, 1)
|
self.assertEqual(wizard.updated_accounts, 1)
|
||||||
self.assertEqual(wizard.updated_fps, 1)
|
self.assertEqual(wizard.updated_fps, 1)
|
||||||
# There is XML-ID now
|
# There is XML-ID now
|
||||||
self.assertTrue(list(self.tax.get_xml_id().values())[0])
|
self.assertTrue(list(self.tax.get_external_id().values())[0])
|
||||||
self.assertTrue(list(self.account.get_xml_id().values())[0])
|
self.assertTrue(list(self.account.get_external_id().values())[0])
|
||||||
self.assertTrue(list(self.fp.get_xml_id().values())[0])
|
self.assertTrue(list(self.fp.get_external_id().values())[0])
|
||||||
wizard.unlink()
|
wizard.unlink()
|
||||||
|
@ -448,12 +448,24 @@ class WizardUpdateChartsAccounts(models.TransientModel):
|
|||||||
repartition_type = tpl.repartition_type
|
repartition_type = tpl.repartition_type
|
||||||
account_id = self.find_account_by_templates(tpl.account_id)
|
account_id = self.find_account_by_templates(tpl.account_id)
|
||||||
tags = self.env["account.account.tag"]
|
tags = self.env["account.account.tag"]
|
||||||
tags += tpl.plus_report_line_ids.mapped("tag_ids").filtered(
|
plus_expressions = tpl.plus_report_expression_ids.filtered(
|
||||||
lambda x: not x.tax_negate
|
lambda x: x.engine == "tax_tags"
|
||||||
)
|
)
|
||||||
tags += tpl.minus_report_line_ids.mapped("tag_ids").filtered(
|
for expression in plus_expressions:
|
||||||
lambda x: x.tax_negate
|
country = expression.report_line_id.report_id.country_id
|
||||||
|
existing_tags = self.env["account.account.tag"]._get_tax_tags(
|
||||||
|
expression.formula, country.id
|
||||||
|
)
|
||||||
|
tags |= existing_tags.filtered(lambda x: not x.tax_negate)
|
||||||
|
minus_expressions = tpl.minus_report_expression_ids.filtered(
|
||||||
|
lambda x: x.engine == "tax_tags"
|
||||||
)
|
)
|
||||||
|
for expression in minus_expressions:
|
||||||
|
country = expression.report_line_id.report_id.country_id
|
||||||
|
existing_tags = self.env["account.account.tag"]._get_tax_tags(
|
||||||
|
expression.formula, country.id
|
||||||
|
)
|
||||||
|
tags |= existing_tags.filtered(lambda x: x.tax_negate)
|
||||||
tags += tpl.tag_ids
|
tags += tpl.tag_ids
|
||||||
existing = self.env["account.tax.repartition.line"]
|
existing = self.env["account.tax.repartition.line"]
|
||||||
existing_candidates = current_repartition.filtered(
|
existing_candidates = current_repartition.filtered(
|
||||||
@ -719,7 +731,8 @@ class WizardUpdateChartsAccounts(models.TransientModel):
|
|||||||
if expected != [] and (
|
if expected != [] and (
|
||||||
key
|
key
|
||||||
in ["invoice_repartition_line_ids", "refund_repartition_line_ids"]
|
in ["invoice_repartition_line_ids", "refund_repartition_line_ids"]
|
||||||
or expected != real[key]
|
or (isinstance(expected, models.Model) and expected != real[key])
|
||||||
|
or (not isinstance(expected, models.Model))
|
||||||
):
|
):
|
||||||
result[key] = expected
|
result[key] = expected
|
||||||
else:
|
else:
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
statusbar_colors='{"ready":"blue","done":"blue"}'
|
statusbar_colors='{"ready":"blue","done":"blue"}'
|
||||||
/>
|
/>
|
||||||
</header>
|
</header>
|
||||||
<group attrs="{'invisible':[('state','!=','init')]}">
|
<div attrs="{'invisible':[('state','!=','init')]}">
|
||||||
<h3>
|
<h3>
|
||||||
<p>
|
<p>
|
||||||
<center>
|
<center>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
</center>
|
</center>
|
||||||
</p>
|
</p>
|
||||||
</h3>
|
</h3>
|
||||||
</group>
|
</div>
|
||||||
<group
|
<group
|
||||||
string="Chart of Accounts"
|
string="Chart of Accounts"
|
||||||
attrs="{'invisible':[('state','!=','init')]}"
|
attrs="{'invisible':[('state','!=','init')]}"
|
||||||
@ -59,7 +59,7 @@
|
|||||||
<field name="recreate_xml_ids" />
|
<field name="recreate_xml_ids" />
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<div>
|
||||||
<h5>
|
<h5>
|
||||||
<p>
|
<p>
|
||||||
If you leave these options set, the wizard will
|
If you leave these options set, the wizard will
|
||||||
@ -70,7 +70,7 @@
|
|||||||
Note: Only the changed fields are updated.
|
Note: Only the changed fields are updated.
|
||||||
</p>
|
</p>
|
||||||
</h5>
|
</h5>
|
||||||
</group>
|
</div>
|
||||||
</page>
|
</page>
|
||||||
<page
|
<page
|
||||||
string="Field options"
|
string="Field options"
|
||||||
@ -335,25 +335,28 @@
|
|||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
<span states="init">
|
<button
|
||||||
<button
|
name="action_find_records"
|
||||||
name="action_find_records"
|
string="Next"
|
||||||
string="Next"
|
type="object"
|
||||||
class="oe_highlight"
|
class="btn-primary"
|
||||||
type="object"
|
states="init"
|
||||||
/>
|
/>
|
||||||
</span>
|
<button
|
||||||
<span states="ready">
|
name="action_init"
|
||||||
<button name="action_init" string="Previous" type="object" />
|
string="Previous"
|
||||||
<button
|
type="object"
|
||||||
name="action_update_records"
|
class="btn-secondary"
|
||||||
string="Create/Update"
|
states="ready"
|
||||||
type="object"
|
/>
|
||||||
class="oe_highlight"
|
<button
|
||||||
/>
|
name="action_update_records"
|
||||||
</span>
|
string="Create/Update"
|
||||||
<span states="init,ready"> or </span>
|
type="object"
|
||||||
<button special="cancel" string="Close" class="oe_link" />
|
class="btn-primary"
|
||||||
|
states="ready"
|
||||||
|
/>
|
||||||
|
<button special="cancel" string="Close" class="btn-secondary" />
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user