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

[13.0][ADD] Add helper functions that make the migration of tax tags for localizations modules l10n_* a lot easier. #286

Merged

Conversation

ddejong-therp
Copy link
Contributor

@ddejong-therp ddejong-therp commented Mar 17, 2022

I'm using these functions in the migration script I'm going to create a pull request for l10n_nl for, but they should be useful for any localization module. Especially the unlink_invalid_tax_tags_from_* functions. When migrating the account module from 12 to 13, the tax tags are structured differently; they are assigned to account.tax.repartition.line instead of accoun.tax itself. However, the account module copies each tag to each new repartition line that it /could possibly/ belong to. This causes issues in the migrated instance in 13.0 and beyond.

I'm using these functions here: OCA/OpenUpgrade#3184

# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

"""Tools specific for migrating from Odoo 12.0 to 13.0.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to put this on a new line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected.

from . import openupgrade

_logger = logging.getLogger('OpenUpgrade')
_logger.setLevel(logging.DEBUG)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't do this. Should be set from configuration. If messages are important enough that by default you want to show them, make them info messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright, I removed the line.

@ddejong-therp ddejong-therp force-pushed the 13.0-add-tax-tags-helper-funcs branch from 1ce0eac to f316619 Compare June 28, 2022 15:25
Copy link
Contributor

@NL66278 NL66278 left a comment

Choose a reason for hiding this comment

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

👍 LGTM and working in practice

@wytzejan
Copy link
Member

@ddejong-therp can this be merged already? I'm in the middle of a Odoo 12 to 13 migration and I get the following error now: ImportError: cannot import name 'openupgrade_130' from 'openupgradelib'. OCA/OpenUpgrade#3184 was already merged but it needs the changes in this PR I think?

@ddejong-therp
Copy link
Contributor Author

ddejong-therp commented Oct 10, 2022

I really hope it would get merged a.s.a.p., I've PR'ed some changes to openupgrade that depend on this. I think I added a warning to that PR that it depended on this. Nevertheless, it got merged before this PR.

However, since you need this as well, maybe you could test this PR for you own DB. I think if just one more person would review it, it would get merged.

@StefanRijnhart StefanRijnhart merged commit 3184c82 into OCA:master Oct 14, 2022
@StefanRijnhart
Copy link
Member

Merging because it is used in OCA/OpenUpgrade#3184.

SELECT res_id FROM ir_model_data
WHERE
model = 'account.account.tag' AND
module = 'l10n_nl' AND
Copy link
Contributor

Choose a reason for hiding this comment

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

l10n_nl?

SELECT res_id FROM ir_model_data
WHERE
model = 'account.account.tag' AND
module = 'l10n_nl' AND
Copy link
Contributor

Choose a reason for hiding this comment

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

l10n_nl?

SELECT res_id FROM ir_model_data
WHERE
model = 'account.account.tag' AND
module = 'l10n_nl' AND
Copy link
Contributor

Choose a reason for hiding this comment

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

l10n_nl?

SELECT res_id FROM ir_model_data
WHERE
model = 'account.account.tag' AND
module = 'l10n_nl' AND
Copy link
Contributor

Choose a reason for hiding this comment

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

l10n_nl?

@ddejong-therp
Copy link
Contributor Author

Oh dear, will fix it asap!

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.

5 participants