Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] account_chart_update: Migration to 17.0 #1989

Open
wants to merge 92 commits into
base: 17.0
Choose a base branch
from

Conversation

victoralmau
Copy link
Member

@victoralmau victoralmau commented Dec 13, 2024

Supersedes #1888

Migration to 17.0

Changes done:

  • Purge translations
  • Squash administrative commits
  • Change name_get to _compute_display_name
  • Change attrs to invisible/required
  • Adapt to the new account.chart.template system without records
  • Remove recreate_xml_ids fields (It is always necessary for them to have the expected xml_id)
  • Adapt tests
  • Improve similar methods to reduce code

Please @pedrobaeza can you review it?

@Tecnativa TT49275

@victoralmau victoralmau force-pushed the 17.0-mig-account_chart_update branch 2 times, most recently from 7eca605 to d6fa9c0 Compare December 13, 2024 17:20
@victoralmau victoralmau marked this pull request as ready for review December 13, 2024 17:24
Copy link

@giarve giarve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

these 3 diffs always appear on runbot even after applying the wizard twice with the same chart. I do not know if you want to take a look. Everything else works good.

It is true though that not being able to edit the chart template from inside odoo is less convenient (to change the number of padding zeroes for example).

account_chart_update/wizard/wizard_chart_update.py Outdated Show resolved Hide resolved
string="Account template",
required=True,
)
xml_id = fields.Char()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only showing the xml id makes it harder to see new accounts and their name.
image

However, this is just an improvement so not requesting anything here. Also might be enough in 99% of the cases.

@victoralmau victoralmau force-pushed the 17.0-mig-account_chart_update branch from d6fa9c0 to ae497db Compare December 17, 2024 12:12
@victoralmau
Copy link
Member Author

image

these 3 diffs always appear on runbot even after applying the wizard twice with the same chart. I do not know if you want to take a look. Everything else works good.

It is true though that not being able to edit the chart template from inside odoo is less convenient (to change the number of padding zeroes for example).

Thanks, checked and fixed.

Copy link
Contributor

@DavidJForgeFlow DavidJForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM! Seems to be working fine also 👍

Copy link
Contributor

@LoisRForgeFlow LoisRForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional review 👍

@pedrobaeza
Copy link
Member

/ocabot migration account_chart_update

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Dec 24, 2024
@OCA-git-bot OCA-git-bot mentioned this pull request Dec 24, 2024
33 tasks
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several things:

  • Is there any possibility to only load in the "Chart template" dropdown those that are already installed?
  • When a tax group is not present (because for example is added in the last update), you get an error. You can force to happen trying to load Spanish taxes on generic CoA for example.

@victoralmau victoralmau force-pushed the 17.0-mig-account_chart_update branch from 49d121b to 313753c Compare January 7, 2025 12:03
@victoralmau
Copy link
Member Author

Several things:

* Is there any possibility to only load in the "Chart template" dropdown those that are already installed?

* When a tax group is not present (because for example is added in the last update), you get an error. You can force to happen trying to load Spanish taxes on generic CoA for example.

Changes done. The test error related to _logger I don't understand, any idea?

@victoralmau victoralmau force-pushed the 17.0-mig-account_chart_update branch from 313753c to b20ed9d Compare January 8, 2025 08:19
@victoralmau
Copy link
Member Author

The test error is finally fixed.

@syci
Copy link

syci commented Jan 10, 2025

The wizard does not take into account the selected language.

https://github.com/Tecnativa/account-financial-tools/blob/b20ed9d7be75352d92041b2478c4af557fa769d4/account_chart_update/wizard/wizard_chart_update.py#L767

In a plan update the name of the taxes always appears in English.

image

With this change it works correctly.

    def _load_data(self, model, data):
        """Process similar to the one in chart template."""
        template = self.env["account.chart.template"].with_context(
            default_company_id=self.company_id.id,
            allowed_company_ids=[self.company_id.id],
            tracking_disable=True,
            delay_account_group_sync=True,
            lang=self.lang,
        )

@victoralmau victoralmau force-pushed the 17.0-mig-account_chart_update branch from b20ed9d to 4346793 Compare January 10, 2025 09:45
@victoralmau
Copy link
Member Author

The wizard does not take into account the selected language.

https://github.com/Tecnativa/account-financial-tools/blob/b20ed9d7be75352d92041b2478c4af557fa769d4/account_chart_update/wizard/wizard_chart_update.py#L767

In a plan update the name of the taxes always appears in English.

image

With this change it works correctly.

    def _load_data(self, model, data):
        """Process similar to the one in chart template."""
        template = self.env["account.chart.template"].with_context(
            default_company_id=self.company_id.id,
            allowed_company_ids=[self.company_id.id],
            tracking_disable=True,
            delay_account_group_sync=True,
            lang=self.lang,
        )

Thanks for the comment, it has been solved so that the language is correctly taken into account (the suggestion you proposed was not enough).

@pedrobaeza
Copy link
Member

The language thing is still not working correctly. Do the following:

  • On a fresh runboat (current one has been contaminated), load Spanish language, and switch to it.
  • Run the chart update with Spanish selected.
  • Result: The accounts in Spanish are update to the English names.

percevaq and others added 4 commits February 4, 2025 12:10
[FIX]: Changed types to orm.Model, orm.TransientModel and orm.AbstractModel.
[FIX]: Fix deletion method for some fields of objects.
[FIX]: Contributions have been written in the standard format of the community.
[FIX]: Changes in the form to work as a real wizard.
[FIX]: Remove 'init_xml' keys, because it's no longer needed in v7.
[FIX]: Rename 'demo_xml' key to the new standard 'demo'.
[FIX]: Change imports calls.
[FIX]: Remove __author__ variables in files, because authors are put on manifest file (__openerp__.py).
[FIX]: Update view definitions to version 7.0
[FIX]: Rename variables to OpenERP standard.
[FIX]: Increased compatibility with standard PEP8.
[IMP]:  User Invitu add the method call _reopen to keep open the wizard.
[MRG]: User Invitu add frech language.
[UPD] Update account_chart_update.pot

[UPD] README.rst

account_chart_update 16.0.1.0.1

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/
Currently translated at 95.1% (117 of 123 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/hr/

Translated using Weblate (Croatian)

Currently translated at 95.9% (118 of 123 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/hr/
Currently translated at 8.1% (10 of 123 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/it/
Currently translated at 100.0% (123 of 123 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/hr/
Currently translated at 8.1% (10 of 123 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/it/
Currently translated at 8.1% (10 of 123 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/sl/

Translated using Weblate (Slovenian)

Currently translated at 100.0% (123 of 123 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/sl/
Currently translated at 100.0% (123 of 123 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/es/
Currently translated at 8.1% (10 of 123 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/it/
Currently translated at 8.9% (11 of 123 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 9.7% (12 of 123 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/pt_BR/
…lse IDs

1) In tax groups repartition lines are not used, however when creating
tax groups from templates the default repartition lines are created.
If you run the chart update again, it will detect those "useless"
default repartition lines and mark them to removal, raising an
error when trying to do so as a minial of 2 repartition lines are
needed (on base and one tax).

2) When matching taxes, if not match, do not add `False` to the list.

account_chart_update 16.0.1.0.2
For improving performance.

[UPD] Update account_chart_update.pot

account_chart_update 16.0.2.0.0

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/
… a recordset

todo_dict["account_dict"]["account.tax"].keys() are already records, not just ID, so we can use them directly. Trying to browse causes an error : `psycopg2.ProgrammingError: can't adapt type 'account.tax'`.

account_chart_update 16.0.2.0.1
…ansactionCase

- Depending on l10n_generic_coa is the lazy option for not putting
  proper initialization data on the test, and it also couples the tests
  to the external module changes.
- Switch to TransactionCase, for populating once the company, CoA, etc.
- Speed up a bit the tests, removing superflual mail operations.

account_chart_update 16.0.2.0.2
Currently translated at 100.0% (137 of 137 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/es/

[UPD] README.rst
Use tax record as key in tax_template_ref dict because in odoo/account/models/chart_template.py line 959, the given key on dict reading is a tax record and not a simple id.

[BOT] post-merge updates
Currently translated at 100.0% (137 of 137 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/es_AR/
Currently translated at 94.1% (129 of 137 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/pt_BR/
Currently translated at 100.0% (137 of 137 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/sv/
Currently translated at 100.0% (137 of 137 strings)

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_chart_update
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update/pt_BR/
… and ditch decorators as mentioned in code review

[BOT] post-merge updates
Changes done:
- Purge translations
- Squash administrative commits
- Change name_get to _compute_display_name
- Change attrs to invisible/required
- Adapt to the new account.chart.template system without records
- Remove recreate_xml_ids fields (It is always necessary for them to have the expected xml_id)

TT49275
@victoralmau victoralmau force-pushed the 17.0-mig-account_chart_update branch from 4346793 to 18e6cfc Compare February 4, 2025 13:27
@victoralmau
Copy link
Member Author

The language thing is still not working correctly. Do the following:

* On a fresh runboat (current one has been contaminated), load Spanish language, and switch to it.

* Run the chart update with Spanish selected.

* Result: The accounts in Spanish are update to the English names.

Partially solved, this use case only happens when using generic_coa in a language other than English, because the data returned is not always translated, I have tried with for example l10n_es in Spanish and it works correctly (it does not detect any change).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.