Skip to content

Commit

Permalink
[ADD] l10n_it_account_stamp: migration scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
primes2h committed Sep 16, 2024
1 parent db9e56b commit d8aa8f9
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
14 changes: 14 additions & 0 deletions l10n_it_account_stamp/migrations/17.5.0.0.1/noupdate_changes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<record id="l10n_it_account_stamp_2_euro" model="product.product">
<field name="name">Stamp duty 2 euro</field>
</record>
<record id="base.main_company" model="res.company">
<field
name="l10n_it_account_stamp_stamp_duty_product_id"
ref="l10n_it_account_stamp.l10n_it_account_stamp_2_euro"
/>
</record>
</odoo>


10 changes: 10 additions & 0 deletions l10n_it_account_stamp/migrations/17.5.0.0.1/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2024 Sergio Zanchetta
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(env.cr, "l10n_it_account_stamp", "17.5.0.0.1/noupdate_changes.xml")
openupgrade.delete_record_translations(env.cr, "l10n_it_account_stamp", ["l10n_it_account_stamp_2_euro"])
58 changes: 58 additions & 0 deletions l10n_it_account_stamp/migrations/17.5.0.0.1/pre-migrate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2024 Sergio Zanchetta
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


def _rename_fields(env):
openupgrade.rename_fields(
env,
[
(
"account.move",
"account_move",
"l10n_it_account_stamp_is_tax_stamp_applied",
"l10n_it_account_stamp_is_stamp_duty_applied",
),
(
"account.move",
"account_move",
"l10n_it_account_stamp_is_tax_stamp_present",
"l10n_it_account_stamp_is_stamp_duty_present",
),
(
"account.move",
"account_move",
"l10n_it_account_stamp_auto_compute_tax_stamp",
"l10n_it_account_stamp_auto_compute_stamp_duty",
),
(
"account.move",
"account_move",
"l10n_it_account_stamp_manually_apply_tax_stamp",
"l10n_it_account_stamp_manually_apply_stamp_duty",
),
(
"res.company",
"res_company",
"l10n_it_account_stamp_tax_stamp_product_id",
"l10n_it_account_stamp_stamp_duty_product_id",
),
(
"res.config.settings",
"res_config_settings",
"l10n_it_account_stamp_tax_stamp_product_id",
"l10n_it_account_stamp_stamp_duty_product_id",
),
(
"product.template",
"product_template",
"l10n_it_account_stamp_tax_stamp_apply_tax_ids",
"l10n_it_account_stamp_stamp_duty_apply_tax_ids",
),
],
)

@openupgrade.migrate()
def migrate(env, version):
_rename_fields(env)

0 comments on commit d8aa8f9

Please sign in to comment.