diff --git a/l10n_it_account/migration_tools.py b/l10n_it_account/migration_tools.py new file mode 100644 index 000000000000..0a05466a7525 --- /dev/null +++ b/l10n_it_account/migration_tools.py @@ -0,0 +1,18 @@ +# Common methods for migrations +from openupgradelib import openupgrade + + +def _remove_module(env, module_name): + query_params = { + "name": module_name, + } + env.cr.execute( + "SELECT id FROM ir_module_module WHERE name = %(name)s", + query_params, + ) + if bool(env.cr.fetchone()): + openupgrade.logged_query( + env.cr, + "UPDATE ir_module_module SET state = 'to remove' WHERE name = %(name)s", + query_params, + ) diff --git a/l10n_it_account/migrations/18.0.1.0.0/post-migration.py b/l10n_it_account/migrations/18.0.1.0.0/post-migration.py index e17757f97bdb..6007db3f4d82 100644 --- a/l10n_it_account/migrations/18.0.1.0.0/post-migration.py +++ b/l10n_it_account/migrations/18.0.1.0.0/post-migration.py @@ -3,6 +3,8 @@ from odoo import SUPERUSER_ID, api +from odoo.addons.l10n_it_account.migration_tools import _remove_module + OLD_MODULES = [ "l10n_it_account_tax_kind", "l10n_it_fatturapa", @@ -131,3 +133,4 @@ def migrate(cr, version): migration_function = globals().get(f"_{module}_migration") if openupgrade.is_module_installed(env.cr, module) and migration_function: migration_function(env) + _remove_module(env, module) diff --git a/l10n_it_edi_extension/README.rst b/l10n_it_edi_extension/README.rst index 4bc9c0ce161f..7d8e87fc66e2 100644 --- a/l10n_it_edi_extension/README.rst +++ b/l10n_it_edi_extension/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - ================================== Italy - E-invoicing - Base Feature ================================== @@ -17,7 +13,7 @@ Italy - E-invoicing - Base Feature .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png :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 diff --git a/l10n_it_edi_extension/__init__.py b/l10n_it_edi_extension/__init__.py index b4b8083d4aa4..1780c6d831b7 100644 --- a/l10n_it_edi_extension/__init__.py +++ b/l10n_it_edi_extension/__init__.py @@ -10,6 +10,7 @@ from openupgradelib import openupgrade, openupgrade_tools from odoo.addons.base.models.ir_qweb_fields import Markup, nl2br, nl2br_enclose +from odoo.addons.l10n_it_account.migration_tools import _remove_module OLD_MODULES = [ "l10n_it_fatturapa", @@ -947,3 +948,4 @@ def _l10n_it_edi_extension_post_init_hook(env): migration_function = globals().get(f"_{module}_post_migration") if openupgrade.is_module_installed(env.cr, module) and migration_function: migration_function(env) + _remove_module(env, module) diff --git a/l10n_it_edi_extension/__manifest__.py b/l10n_it_edi_extension/__manifest__.py index ad20fbe15db6..7e71ef151be5 100644 --- a/l10n_it_edi_extension/__manifest__.py +++ b/l10n_it_edi_extension/__manifest__.py @@ -18,6 +18,7 @@ }, "depends": [ "account", + "l10n_it_account", "l10n_it_edi", "l10n_it_edi_ndd", "partner_firstname", diff --git a/l10n_it_edi_extension/static/description/index.html b/l10n_it_edi_extension/static/description/index.html index b0c1f1b2de28..807271416c0c 100644 --- a/l10n_it_edi_extension/static/description/index.html +++ b/l10n_it_edi_extension/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Italy - E-invoicing - Base Feature -
+
+

Italy - E-invoicing - Base Feature

- - -Odoo Community Association - -
-

Italy - E-invoicing - Base Feature

-

Beta License: AGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runboat

Italiano

Questo modulo estende le funzionalità standard della fatturazione elettronica italiana di Odoo, introducendo strumenti utili come @@ -712,7 +707,7 @@

Italy - E-invoicing - Base Feature

-

Configuration

+

Configuration

Italiano

Le uniche configurazioni disponibili sono:

    @@ -824,7 +819,7 @@

    Configuration

    with what is found in one of their imported e-bill.

-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub 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 @@ -832,15 +827,15 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Giuseppe Borruso
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -870,6 +865,5 @@

Maintainers

-
diff --git a/l10n_it_edi_related_document/__init__.py b/l10n_it_edi_related_document/__init__.py index e0b34e8abca3..f5fd32813762 100644 --- a/l10n_it_edi_related_document/__init__.py +++ b/l10n_it_edi_related_document/__init__.py @@ -1,26 +1,25 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from . import models -from openupgradelib import openupgrade +from openupgradelib import openupgrade_tools def _insert_account_move_related_document(env): cr = env.cr - cr.execute("SELECT * FROM fatturapa_related_document_type LIMIT 1") - if cr.fetchone(): - cr.execute(""" - INSERT INTO account_move_related_document ( - type, name, "lineRef", invoice_id, invoice_line_id, date, - numitem, code, cig, cup - ) - SELECT - type, name, "lineRef", invoice_id, invoice_line_id, date, - numitem, code, cig, cup - FROM fatturapa_related_document_type - """) + if openupgrade_tools.table_exists(cr, "fatturapa_related_document_type"): + cr.execute("SELECT * FROM fatturapa_related_document_type LIMIT 1") + if cr.fetchone(): + cr.execute(""" + INSERT INTO account_move_related_document ( + type, name, "lineRef", invoice_id, invoice_line_id, date, + numitem, code, cig, cup + ) + SELECT + type, name, "lineRef", invoice_id, invoice_line_id, date, + numitem, code, cig, cup + FROM fatturapa_related_document_type + """) def _l10n_it_edi_related_document_post_init_hook(env): - module = "l10n_it_fatturapa" - if openupgrade.is_module_installed(env.cr, module): - _insert_account_move_related_document(env) + _insert_account_move_related_document(env)