-
-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] l10n_it_accompanying_invoice: Migration to 16.0
- Loading branch information
1 parent
365ccc3
commit 78d2c69
Showing
32 changed files
with
675 additions
and
185 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
l10n_it_accompanying_invoice/i18n/l10n_it_accompanying_invoice.pot
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
l10n_it_accompanying_invoice/__init__.py → l10n_it_shipping_invoice/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import models | ||
from .hooks import pre_absorb_old_module |
13 changes: 10 additions & 3 deletions
13
l10n_it_accompanying_invoice/__manifest__.py → l10n_it_shipping_invoice/__manifest__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
# Copyright 2017 Lorenzo Battistini - Agile Business Group | ||
# Copyright 2020 Simone Vanin - Agile Business Group | ||
# Copyright 2023 Simone Rubino - Aion Tech | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "ITA - Fattura accompagnatoria", | ||
"summary": "Stampa della fattura accompagnatoria", | ||
"version": "12.0.1.0.0", | ||
"version": "16.0.1.0.0", | ||
"category": "Accounting", | ||
"website": "https://github.com/OCA/l10n-italy" | ||
"/tree/12.0/l10n_it_accompanying_invoice", | ||
"/tree/16.0/l10n_it_shipping_invoice", | ||
"author": "Agile Business Group, " "Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": [ | ||
"l10n_it_ddt", | ||
"l10n_it_delivery_note", | ||
], | ||
"data": [ | ||
"views/account.xml", | ||
"views/report_invoice.xml", | ||
], | ||
"external_dependencies": { | ||
"python": [ | ||
"openupgradelib", | ||
], | ||
}, | ||
"pre_init_hook": "pre_absorb_old_module", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Copyright 2023 Simone Rubino - Aion Tech | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from openupgradelib import openupgrade | ||
from openupgradelib.openupgrade import logged_query | ||
|
||
from odoo.tools import DotDict | ||
|
||
NEW_MODULE_NAME = "l10n_it_accompanying_invoice" | ||
OLD_MODULE_NAME = "l10n_it_shipping_invoice" | ||
|
||
RENAMED_FIELDS = [ | ||
( | ||
"account.move", | ||
"account_move", | ||
"note", | ||
"delivery_note", | ||
), | ||
( | ||
"account.move", | ||
"account_move", | ||
"date_done", | ||
"delivery_transport_datetime", | ||
), | ||
] | ||
|
||
RENAMED_XMLIDS = [ | ||
( | ||
"invoice_form_view_uom", | ||
"view_move_form", | ||
), | ||
( | ||
"invoice_form_view_uom", | ||
"shipping_invoice_report", | ||
), | ||
( | ||
"invoice_form_view_uom", | ||
"shipping_invoice_template", | ||
), | ||
( | ||
"invoice_form_view_uom", | ||
"report_shipping_invoice", | ||
), | ||
] | ||
|
||
|
||
def remove_models(cr, model_spec): | ||
for name in model_spec: | ||
logged_query( | ||
cr, | ||
"DELETE FROM ir_model WHERE model = %s", | ||
(name,), | ||
) | ||
|
||
|
||
def migrate_old_module(cr): | ||
openupgrade.rename_fields( | ||
# The method only needs the cursor, not the whole Environment | ||
DotDict( | ||
cr=cr, | ||
), | ||
RENAMED_FIELDS, | ||
# Prevent Environment usage | ||
# whenever it will be implemented. | ||
no_deep=True, | ||
) | ||
full_renamed_xmlids = [ | ||
( | ||
".".join((NEW_MODULE_NAME, old_xmlid)), | ||
".".join((NEW_MODULE_NAME, new_xmlid)), | ||
) | ||
for old_xmlid, new_xmlid in RENAMED_XMLIDS | ||
] | ||
openupgrade.rename_xmlids( | ||
cr, | ||
full_renamed_xmlids, | ||
) | ||
|
||
|
||
def pre_absorb_old_module(cr): | ||
if openupgrade.is_module_installed(cr, OLD_MODULE_NAME): | ||
openupgrade.update_module_names( | ||
cr, | ||
[ | ||
(OLD_MODULE_NAME, NEW_MODULE_NAME), | ||
], | ||
merge_modules=True, | ||
) | ||
migrate_old_module(cr) |
Oops, something went wrong.