Skip to content

Commit

Permalink
[IMP] l10n_it_riba: add slip and slip line states mig
Browse files Browse the repository at this point in the history
  • Loading branch information
odooNextev committed Jan 12, 2024
1 parent fc306e1 commit d94f567
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 12 deletions.
39 changes: 27 additions & 12 deletions l10n_it_riba/migrations/16.0.1.0.0/post-migrate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2023 Simone Rubino - AionTech
# Copyright 2024 Nextev Srl
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade
Expand All @@ -13,19 +14,33 @@ def migrate(env, version):
NEW_MODULE_NAME,
"migrations/16.0.1.0.0/data/noupdate.xml",
)
# remove riba.distinta[.line].state refs
distinta_line_state_refs = env["ir.model.data"].search(

openupgrade.map_values(
env.cr,
openupgrade.get_legacy_name("riba_distinta_line"),
"state",
[
("module", "=", "l10n_it_riba"),
("name", "like", "selection__riba_distinta_line__state__%"),
]
("draft", "draft"),
("confirmed", "confirmed"),
("accredited", "credited"),
("paid", "paid"),
("unsolved", "past_due"),
("cancel", "cancel"),
],
table="riba_slip_line",
)
distinta_line_state_refs.unlink()
# remove riba.distinta.state refs
distinta_line_refs = env["ir.model.data"].search(

openupgrade.map_values(
env.cr,
openupgrade.get_legacy_name("riba_distinta"),
"state",
[
("module", "=", "l10n_it_riba"),
("name", "like", "selection__riba_distinta__state%%"),
]
("draft", "draft"),
("accepted", "accepted"),
("accredited", "credited"),
("paid", "paid"),
("unsolved", "past_due"),
("cancel", "cancel"),
],
table="riba_slip",
)
distinta_line_refs.unlink()
15 changes: 15 additions & 0 deletions l10n_it_riba/migrations/16.0.1.0.0/pre-migrate.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
# Copyright 2023 Simone Rubino - AionTech
# Copyright 2024 Nextev Srl
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade

from . import hooks


def migrate(cr, installed_version):
# Used by OpenUpgrade when module is in `apriori`
hooks.migrate_old_module(cr)

# copy old riba.distinta.line.state refs
openupgrade.copy_columns(
cr,
{"riba_distinta_line": [("state", None, None)]},
)

# copy old riba.distinta.state refs
openupgrade.copy_columns(
cr,
{"riba_distinta": [("state", None, None)]},
)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ asn1crypto
codicefiscale
elementpath
mock
openupgradelib
unidecode
xmlschema

0 comments on commit d94f567

Please sign in to comment.