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 Dec 30, 2023
1 parent c659113 commit 0c306c2
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 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,33 @@
# 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):
print("POST INSTALL HOOK CALLED")
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 0c306c2

Please sign in to comment.