From 1cbc3c9c2547b7242a5ba0b8428abd200d4d95eb Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Mon, 25 May 2026 22:02:12 -0400 Subject: [PATCH] [OU-ADD] l10n_it: rename_xmlids for l10n_it_edi_withholding consolidation rename_xmlids moves 10 records' ir_model_data ownership from l10n_it_edi_withholding to l10n_it (the withholding-tax module folds into base l10n_it in 19.0): 1 account.report + 1 column + 4 expressions + 4 lines. Without this, customer references via account.tax.tag_ids to the withholding line tags would dangle. --- docsource/modules180-190.rst | 2 +- .../scripts/l10n_it/19.0.0.9/pre-migration.py | 51 +++++++++++++++++++ .../19.0.0.9/upgrade_analysis_work.txt | 40 +++++++++++++++ 3 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 openupgrade_scripts/scripts/l10n_it/19.0.0.9/pre-migration.py create mode 100644 openupgrade_scripts/scripts/l10n_it/19.0.0.9/upgrade_analysis_work.txt diff --git a/docsource/modules180-190.rst b/docsource/modules180-190.rst index e7f797ce0766..9e26d14e4ca2 100644 --- a/docsource/modules180-190.rst +++ b/docsource/modules180-190.rst @@ -482,7 +482,7 @@ Module coverage 18.0 -> 19.0 +---------------------------------------------------+----------------------+-------------------------------------------------+ | l10n_iq | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ -| l10n_it | | | +| l10n_it |Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ | l10n_it_edi | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/l10n_it/19.0.0.9/pre-migration.py b/openupgrade_scripts/scripts/l10n_it/19.0.0.9/pre-migration.py new file mode 100644 index 000000000000..b45446124651 --- /dev/null +++ b/openupgrade_scripts/scripts/l10n_it/19.0.0.9/pre-migration.py @@ -0,0 +1,51 @@ +from openupgradelib import openupgrade + +# l10n_it_edi_withholding is being folded into l10n_it in 19.0 (the +# withholding-tax module's records consolidate into the base l10n_it +# Italian-localization module). The 10 records below ship in l10n_it's +# 19.0 data files but had their 18.0 ir_model_data rows under +# module='l10n_it_edi_withholding'. +# +# Without renaming the xmlids in pre-migration, the Odoo install would +# create fresh ir_model_data rows pointing at new res_ids — the legacy +# rows would dangle, and customer references to the previous +# tax-report records (e.g. report-line tags attached to specific +# account.tax records via tag_ids) would be orphaned. +# +# Source: upgrade_analysis.txt — "renamed from l10n_it_edi_withholding +# module" lines. +# +# NOTE: this version of l10n_it also contains a large standard +# tax-report refactor (100+ DEL / 50+ NEW account.report.line and +# account.report.expression records under l10n_it own xmlids). Those +# are handled by the standard module-upgrade flow and don't need +# pre-migration logic — they're not the subject of this script. +# See openupgrade/TODO.md §4.3.1 for the broader campaign note. + +_renamed_xmlids = [ + ("l10n_it_edi_withholding.withh_tax_report_it", + "l10n_it.withh_tax_report_it"), + ("l10n_it_edi_withholding.withh_tax_report_balance", + "l10n_it.withh_tax_report_balance"), + ("l10n_it_edi_withholding.enasarco_purchase_tax_report_it_line_tag", + "l10n_it.enasarco_purchase_tax_report_it_line_tag"), + ("l10n_it_edi_withholding.enasarco_sale_tax_report_it_line_tag", + "l10n_it.enasarco_sale_tax_report_it_line_tag"), + ("l10n_it_edi_withholding.withh_purchase_tax_report_it_line_tag", + "l10n_it.withh_purchase_tax_report_it_line_tag"), + ("l10n_it_edi_withholding.withh_sale_tax_report_it_line_tag", + "l10n_it.withh_sale_tax_report_it_line_tag"), + ("l10n_it_edi_withholding.enasarco_purchase_tax_report_it_line", + "l10n_it.enasarco_purchase_tax_report_it_line"), + ("l10n_it_edi_withholding.enasarco_sale_tax_report_it_line", + "l10n_it.enasarco_sale_tax_report_it_line"), + ("l10n_it_edi_withholding.withh_purchase_tax_report_it_line", + "l10n_it.withh_purchase_tax_report_it_line"), + ("l10n_it_edi_withholding.withh_sale_tax_report_it_line", + "l10n_it.withh_sale_tax_report_it_line"), +] + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.rename_xmlids(env.cr, _renamed_xmlids) diff --git a/openupgrade_scripts/scripts/l10n_it/19.0.0.9/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/l10n_it/19.0.0.9/upgrade_analysis_work.txt new file mode 100644 index 000000000000..c62421c9336d --- /dev/null +++ b/openupgrade_scripts/scripts/l10n_it/19.0.0.9/upgrade_analysis_work.txt @@ -0,0 +1,40 @@ +---Models in module 'l10n_it'--- +---Fields in module 'l10n_it'--- +l10n_it / account.tax / l10n_it_law_reference (char) : DEL + +# NOTHING TO DO: legacy law-reference char on account.tax; the 19.0 chart +# template doesn't re-create it and the value is purely informational +# (operator-set descriptive text). Standard module-upgrade flow handles +# the column drop — if a customer wants to preserve the value before +# database_cleanup removes it, they can do so as a separate one-time +# script. + +---XML records in module 'l10n_it'--- + +# DONE — the 10 xmlid renames from l10n_it_edi_withholding to l10n_it +# (withholding-tax module folded into the base l10n_it module). Handled +# in pre-migration.py via openupgrade.rename_xmlids. Without this, +# customer references to the previous tax-report records (e.g. tag_ids +# on account.tax pointing at the withholding line definitions) would be +# orphaned when Odoo's 19.0 install creates fresh ir_model_data rows +# pointing at new res_ids. + +NEW account.report: l10n_it.withh_tax_report_it [renamed from l10n_it_edi_withholding module] +NEW account.report.column: l10n_it.withh_tax_report_balance [renamed from l10n_it_edi_withholding module] +NEW account.report.expression: l10n_it.enasarco_purchase_tax_report_it_line_tag [renamed from l10n_it_edi_withholding module] +NEW account.report.expression: l10n_it.enasarco_sale_tax_report_it_line_tag [renamed from l10n_it_edi_withholding module] +NEW account.report.expression: l10n_it.withh_purchase_tax_report_it_line_tag [renamed from l10n_it_edi_withholding module] +NEW account.report.expression: l10n_it.withh_sale_tax_report_it_line_tag [renamed from l10n_it_edi_withholding module] +NEW account.report.line: l10n_it.enasarco_purchase_tax_report_it_line [renamed from l10n_it_edi_withholding module] +NEW account.report.line: l10n_it.enasarco_sale_tax_report_it_line [renamed from l10n_it_edi_withholding module] +NEW account.report.line: l10n_it.withh_purchase_tax_report_it_line [renamed from l10n_it_edi_withholding module] +NEW account.report.line: l10n_it.withh_sale_tax_report_it_line [renamed from l10n_it_edi_withholding module] + +# NOTHING TO DO — broader tax-report refactor. The rest of this analysis +# file documents a substantial 19.0 restructuring of the IT VAT tax +# report under l10n_it's own xmlids: ~50 NEW account.report.expression / +# account.report.line records, ~110 DEL of the previous report rows. +# All of these are standard module-data XML — the NEW records install, +# the DEL records are removed by Odoo's standard module-upgrade flow. +# No customer data references the lines directly (they're report-shape +# definitions, not data rows). No migration logic needed.