Skip to content

Commit

Permalink
[MIG] account_chart_update: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-cort-s73 committed Feb 14, 2025
1 parent 6b72249 commit 40a2d21
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 75 deletions.
58 changes: 29 additions & 29 deletions account_chart_update/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Detect changes and update the Account Chart from a template
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |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/17.0/account_chart_update
:target: https://github.com/OCA/account-financial-tools/tree/18.0/account_chart_update
:alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-tools-17-0/account-financial-tools-17-0-account_chart_update
:target: https://translation.odoo-community.org/projects/account-financial-tools-18-0/account-financial-tools-18-0-account_chart_update
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-financial-tools&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-financial-tools&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -34,12 +34,12 @@ on the chart template.

The wizard:

- Allows the user to compare a chart and a template showing differences
on accounts, taxes, tax codes and fiscal positions.
- It may create the new account, taxes, tax codes and fiscal positions
detected on the template.
- It can also update (overwrite) the accounts, taxes, tax codes and
fiscal positions that got modified on the template.
- Allows the user to compare a chart and a template showing differences
on accounts, taxes, tax codes and fiscal positions.
- It may create the new account, taxes, tax codes and fiscal positions
detected on the template.
- It can also update (overwrite) the accounts, taxes, tax codes and
fiscal positions that got modified on the template.

**Table of contents**

Expand All @@ -61,19 +61,19 @@ to exclude records individually.
Known issues / Roadmap
======================

- Generate and update account reconcile models.
- Generate XML-ID for fiscal position tax and account mapping lines.
- Allow to select independently operations to perform (create, update,
deactivate).
- Detect fiscal positions to deactivate?
- Generate and update account reconcile models.
- Generate XML-ID for fiscal position tax and account mapping lines.
- Allow to select independently operations to perform (create, update,
deactivate).
- Detect fiscal positions to deactivate?

Bug Tracker
===========

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.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_chart_update%0Aversion:%2017.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:%2018.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.

Expand All @@ -90,23 +90,23 @@ Authors
Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__:
- `Tecnativa <https://www.tecnativa.com>`__:

- Pedro M. Baeza
- Ernesto Tejeda
- Víctor Martínez
- Pedro M. Baeza
- Ernesto Tejeda
- Víctor Martínez

- Jacques-Etienne Baudoux <[email protected]>
- Sylvain Van Hoof <[email protected]>
- Nacho Muñoz <[email protected]>
- Alberto Martín - Guadaltech <[email protected]>
- Fernando La Chica - GreenIce <[email protected]>
- Jairo Llopis (https://www.moduon.team/)
- `Factor Libre <https://factorlibre.com>`__:
- Jacques-Etienne Baudoux <[email protected]>
- Sylvain Van Hoof <[email protected]>
- Nacho Muñoz <[email protected]>
- Alberto Martín - Guadaltech <[email protected]>
- Fernando La Chica - GreenIce <[email protected]>
- Jairo Llopis (https://www.moduon.team/)
- `Factor Libre <https://factorlibre.com>`__:

- Luis J. Salvatierra
- Luis J. Salvatierra

- Daniel Reis ([email protected])
- Daniel Reis ([email protected])

Maintainers
-----------
Expand All @@ -121,6 +121,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/17.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/18.0/account_chart_update>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion account_chart_update/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"name": "Detect changes and update the Account Chart from a template",
"summary": "Wizard to update a company's account chart from a template",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"author": "Tecnativa, BCIM, Okia, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools",
"depends": ["account"],
Expand Down
6 changes: 3 additions & 3 deletions account_chart_update/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Detect changes and update the Account Chart from a template</h
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4b9ad640a2561ddbe28d1e7f433424bd1d430e783546e974aac1a84f8f33e1da
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/account-financial-tools/tree/17.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 image-reference" href="https://translation.odoo-community.org/projects/account-financial-tools-17-0/account-financial-tools-17-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 image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-financial-tools&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/account-financial-tools/tree/18.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 image-reference" href="https://translation.odoo-community.org/projects/account-financial-tools-18-0/account-financial-tools-18-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 image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-financial-tools&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<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 template.</p>
Expand Down Expand Up @@ -421,7 +421,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<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.
If you spotted it first, help us to smash 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:%2017.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:%2018.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>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -465,7 +465,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
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/17.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/18.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>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion account_chart_update/tests/test_account_chart_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_chart_update_01(self):
self.assertFalse(wizard.fiscal_position_ids)
wizard.unlink()
# Check that no action is performed if the option is not selected
wizard_vals = self.wizard_vals.copy()
wizard_vals = self.wizard_vals.copy_data()
wizard_vals.update(
{
"update_tax": False,
Expand Down
49 changes: 24 additions & 25 deletions account_chart_update/wizard/wizard_chart_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import logging

from odoo import _, api, fields, models, tools
from odoo import api, fields, models, tools

_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -557,7 +557,8 @@ def diff_notes(self, record_values, real):
)
if different_fields:
result.append(
_("Differences in these fields: %s.") % ", ".join(different_fields)
self.env._("Differences in these fields: %s.")
% ", ".join(different_fields)
)
return "\n".join(result)

Expand Down Expand Up @@ -647,15 +648,15 @@ def _find_taxes(self, t_data):
"type_tax_use": r_data["type_tax_use"],
"update_chart_wizard_id": self.id,
"type": "new",
"notes": _("Name or description not found."),
"notes": self.env._("Name or description not found."),
}
)
else:
found_taxes_ids.append(tax.id)
# Check the tax for changes
notes = self.diff_notes(r_data, tax)
if self.missing_xml_id(tax, xmlid):
notes += (notes and "\n" or "") + _("Missing XML-ID.")
notes += (notes and "\n" or "") + self.env._("Missing XML-ID.")
if notes:
# Tax to be updated
tax_vals.append(
Expand All @@ -680,7 +681,7 @@ def _find_taxes(self, t_data):
"type_tax_use": tax.type_tax_use,
"type": "deleted",
"update_tax_id": tax.id,
"notes": _("To deactivate: not in the template"),
"notes": self.env._("To deactivate: not in the template"),
}
)
self.tax_ids = [(5, 0, 0)] + [(0, 0, tax_val) for tax_val in tax_vals]
Expand All @@ -697,14 +698,14 @@ def _find_accounts(self, t_data):
"xml_id": xmlid,
"update_chart_wizard_id": self.id,
"type": "new",
"notes": _("No account found with this code."),
"notes": self.env._("No account found with this code."),
}
)
else:
# Check the account for changes
notes = self.diff_notes(r_data, account)
if self.missing_xml_id(account, xmlid):
notes += (notes and "\n" or "") + _("Missing XML-ID.")
notes += (notes and "\n" or "") + self.env._("Missing XML-ID.")
if notes:
# Account to be updated
account_vals.append(
Expand All @@ -730,7 +731,7 @@ def _find_account_groups(self, t_data):
"xml_id": xmlid,
"update_chart_wizard_id": self.id,
"type": "new",
"notes": _("No account found with this code."),
"notes": self.env._("No account found with this code."),
}
)
else:
Expand All @@ -739,15 +740,15 @@ def _find_account_groups(self, t_data):
code_prefix_end = (
r_data["code_prefix_end"]
if "code_prefix_end" in r_data
and r_data["code_prefix_end"] < r_data["code_prefix_start"]
and (r_data["code_prefix_end"] < r_data["code_prefix_start"])
else r_data["code_prefix_start"]
)
if code_prefix_end != account_group.code_prefix_end:
notes += (notes and "\n" or "") + _(
notes += (notes and "\n" or "") + self.env._(
"Differences in these fields: %s."
) % r_data["code_prefix_end"]
if self.missing_xml_id(account_group, xmlid):
notes += (notes and "\n" or "") + _("Missing XML-ID.")
notes += (notes and "\n" or "") + self.env._("Missing XML-ID.")
if notes:
# Account to be updated
ag_vals.append(
Expand All @@ -773,14 +774,14 @@ def _find_fiscal_positions(self, t_data):
"xml_id": xmlid,
"update_chart_wizard_id": self.id,
"type": "new",
"notes": _("No fiscal position found with this name."),
"notes": self.env._("No fiscal position found with this name."),
}
)
else:
# Check the fiscal position for changes
notes = self.diff_notes(r_data, fp)
if self.missing_xml_id(fp, xmlid):
notes += (notes and "\n" or "") + _("Missing XML-ID.")
notes += (notes and "\n" or "") + self.env._("Missing XML-ID.")
if notes:
# Fiscal position template to be updated
fp_vals.append(
Expand Down Expand Up @@ -821,7 +822,8 @@ def _load_data(self, model, data):
if isinstance(xml_id, int):
record = self.env[model].browse(xml_id)
else:
xml_id = f"{('account.' + str(self.company_id.id) + '_') if '.' not in xml_id else ''}{xml_id}"
prefix = f"account.{self.company_id.id}_" if "." not in xml_id else ""
xml_id = f"{prefix}{xml_id}"
record = self.env.ref(xml_id)
# Updatr translation vals
for lang in langs:
Expand All @@ -830,7 +832,7 @@ def _load_data(self, model, data):
translation_vals = translation_vals_lang[lang.code]
record.with_context(lang=lang.code).write(translation_vals)
for record in created_records:
msg = _(
msg = self.env._(
(f"Created/updated {record._name} %s."),
f"'{record.name}' (ID:{record.id})",
)
Expand All @@ -848,7 +850,7 @@ def _update_taxes(self, t_data):
tax = wiz_tax.update_tax_id
if wiz_tax.type == "deleted":
tax.active = False
_logger.info(_("Deactivated tax %s."), "'%s'" % tax.name)
_logger.info(self.env._("Deactivated tax %s."), tax.name)
continue
xml_id = wiz_tax.xml_id
key = tax.id or xml_id
Expand Down Expand Up @@ -968,9 +970,8 @@ def _get_account_tax_type_tax_uses(self):

class WizardUpdateChartsAccountsAccount(models.TransientModel):
_name = "wizard.update.charts.accounts.account"
_description = (
"Account that needs to be updated (new or updated in the " "template)."
)
_description = "Account that needs to be updated "
"(new or updated in the " "template)."

xml_id = fields.Char()
update_chart_wizard_id = fields.Many2one(
Expand All @@ -994,9 +995,8 @@ class WizardUpdateChartsAccountsAccount(models.TransientModel):

class WizardUpdateChartsAccountsAccountGroup(models.TransientModel):
_name = "wizard.update.charts.accounts.account.group"
_description = (
"Account group that needs to be updated (new or updated in the template)."
)
_description = "Account group that needs to be updated "
"(new or updated in the template)."

xml_id = fields.Char()
update_chart_wizard_id = fields.Many2one(
Expand All @@ -1020,9 +1020,8 @@ class WizardUpdateChartsAccountsAccountGroup(models.TransientModel):

class WizardUpdateChartsAccountsFiscalPosition(models.TransientModel):
_name = "wizard.update.charts.accounts.fiscal.position"
_description = (
"Fiscal position that needs to be updated (new or updated " "in the template)."
)
_description = "Fiscal position that needs to be updated "
"(new or updated " "in the template)."

xml_id = fields.Char()
update_chart_wizard_id = fields.Many2one(
Expand Down
Loading

0 comments on commit 40a2d21

Please sign in to comment.