Skip to content

Commit

Permalink
[IMP] l10n_nl_account_tax_unece: add migration script
Browse files Browse the repository at this point in the history
  • Loading branch information
bosd committed Mar 26, 2024
1 parent 68686f1 commit 322746f
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions l10n_nl_account_tax_unece/migrations/14.0.1.1.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 2021 Bosd
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

"""
The unece tags have been set with the no update tag.
Use openupgradelib to force load the changes.
"""


import logging

from odoo import SUPERUSER_ID, api

_logger = logging.getLogger(__name__)
try:
from openupgradelib import openupgrade
except ImportError:
openupgrade = None


def set_unece_on_taxes(cr):
with api.Environment.manage():
env = api.Environment(cr, SUPERUSER_ID, {})
for company in env["res.company"].search([]):
company._l10n_nl_set_unece_on_taxes()


def migrate(cr, version):
if openupgrade is None:
_logger.warning(
"OpenUpgradeLib is not found, can't update l10n_nl_account_tax_unece tags"
)
return
_logger.warning("OpenUpgradeLib is going to upgrade nl l10n_nl_account_tax_unece")
openupgrade.load_data(
cr, "l10n_nl_account_tax_unece", "data/account_tax_template.xml", mode="init"
)
set_unece_on_taxes(cr)

0 comments on commit 322746f

Please sign in to comment.