diff --git a/l10n_it_vat_statement_communication/__manifest__.py b/l10n_it_vat_statement_communication/__manifest__.py index 4f66f12d2b3f..7436ec1139eb 100644 --- a/l10n_it_vat_statement_communication/__manifest__.py +++ b/l10n_it_vat_statement_communication/__manifest__.py @@ -5,7 +5,7 @@ "name": "ITA - Comunicazione liquidazione IVA", "summary": "Comunicazione liquidazione IVA ed esportazione file xml" "conforme alle specifiche dell'Agenzia delle Entrate", - "version": "16.0.1.0.0", + "version": "16.0.1.1.0", "category": "Account", "author": "Openforce di Camilli Alessandro, Odoo Community Association (OCA)", "website": "https://github.com/OCA/l10n-italy", diff --git a/l10n_it_vat_statement_communication/migrations/16.0.1.1.0/pre-migrate.py b/l10n_it_vat_statement_communication/migrations/16.0.1.1.0/pre-migrate.py new file mode 100644 index 000000000000..1d5daf75b7ba --- /dev/null +++ b/l10n_it_vat_statement_communication/migrations/16.0.1.1.0/pre-migrate.py @@ -0,0 +1,40 @@ +import logging + +from openupgradelib import openupgrade + +_logger = logging.getLogger(__name__) + + +@openupgrade.migrate() +def migrate(env, version): + if not version: + return + + rm_old_vat_communication_multi_company_rule(env) + + +def rm_old_vat_communication_multi_company_rule(env): + _logger.info( + "Migration of l10n_it_vat_statement_communication - search for" + " previous multi company rule for 'comunicazione.liquidazione' model" + ) + module = "l10n_it_vat_statement_communication" + rule_xml_id = "comunucazione_liquidazione_iva_multi_company" + old_vat_comm_multi_company_rule_ref = env.ref( + f"{module}.{rule_xml_id}", raise_if_not_found=False + ) + + if not old_vat_comm_multi_company_rule_ref: + # avoid unlink not existent record + _logger.warning( + "Migration of l10n_it_vat_statement_communication - previous" + " multi company rule for 'comunicazione.liquidazione' model not" + " found" + ) + return + + _logger.info( + "Migration of l10n_it_vat_statement_communication - unlink" + " previous multi company rule for 'comunicazione.liquidazione' model" + ) + old_vat_comm_multi_company_rule_ref.unlink()