Skip to content

Commit

Permalink
[MIG] l10n_it_accompanying_invoice: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SirAionTech committed Mar 6, 2024
1 parent 2ef14b0 commit cd3fdba
Show file tree
Hide file tree
Showing 32 changed files with 675 additions and 185 deletions.
46 changes: 0 additions & 46 deletions l10n_it_accompanying_invoice/i18n/it.po

This file was deleted.

35 changes: 0 additions & 35 deletions l10n_it_accompanying_invoice/i18n/l10n_it_accompanying_invoice.pot

This file was deleted.

13 changes: 0 additions & 13 deletions l10n_it_accompanying_invoice/models/account_invoice.py

This file was deleted.

17 changes: 0 additions & 17 deletions l10n_it_accompanying_invoice/tests/test_report.py

This file was deleted.

15 changes: 0 additions & 15 deletions l10n_it_accompanying_invoice/views/account.xml

This file was deleted.

37 changes: 0 additions & 37 deletions l10n_it_accompanying_invoice/views/report_invoice.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ ITA - Fattura accompagnatoria
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_accompanying_invoice
:target: https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_shipping_invoice
:alt: OCA/l10n-italy
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_accompanying_invoice
:target: https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_shipping_invoice
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=16.0
Expand Down Expand Up @@ -51,13 +51,18 @@ Valorizzare i campi del foglio *Informazioni di spedizione*.
Usare l'azione *Fattura accompagnatoria* all'interno della lista di
azioni *Stampa*, nella vista delle fatture.

Known issues / Roadmap
======================

The migration script hasn't been tested.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_accompanying_invoice%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_shipping_invoice%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -88,6 +93,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_accompanying_invoice>`_ project on GitHub.
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_shipping_invoice>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
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
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",
}
89 changes: 89 additions & 0 deletions l10n_it_shipping_invoice/hooks.py
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(

Check warning on line 49 in l10n_it_shipping_invoice/hooks.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_shipping_invoice/hooks.py#L49

Added line #L49 was not covered by tests
cr,
"DELETE FROM ir_model WHERE model = %s",
(name,),
)


def migrate_old_module(cr):
openupgrade.rename_fields(

Check warning on line 57 in l10n_it_shipping_invoice/hooks.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_shipping_invoice/hooks.py#L57

Added line #L57 was not covered by tests
# 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(

Check warning on line 74 in l10n_it_shipping_invoice/hooks.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_shipping_invoice/hooks.py#L74

Added line #L74 was not covered by tests
cr,
full_renamed_xmlids,
)


def pre_absorb_old_module(cr):
if openupgrade.is_module_installed(cr, OLD_MODULE_NAME):
openupgrade.update_module_names(

Check warning on line 82 in l10n_it_shipping_invoice/hooks.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_shipping_invoice/hooks.py#L82

Added line #L82 was not covered by tests
cr,
[
(OLD_MODULE_NAME, NEW_MODULE_NAME),
],
merge_modules=True,
)
migrate_old_module(cr)

Check warning on line 89 in l10n_it_shipping_invoice/hooks.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_shipping_invoice/hooks.py#L89

Added line #L89 was not covered by tests
Loading

0 comments on commit cd3fdba

Please sign in to comment.