From 5629fe6202529cedda563c74e5a7c78a2d36bee2 Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Fri, 15 May 2026 18:32:14 -0400 Subject: [PATCH] [OU-ADD] account_peppol: rename transient wizard model + table --- docsource/modules180-190.rst | 2 +- .../account_peppol/19.0.1.2/pre-migration.py | 10 ++++++ .../tests/test_account_peppol_migration.py | 27 ++++++++++++++ .../19.0.1.2/upgrade_analysis_work.txt | 36 +++++++++++++++++++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 openupgrade_scripts/scripts/account_peppol/19.0.1.2/pre-migration.py create mode 100644 openupgrade_scripts/scripts/account_peppol/19.0.1.2/tests/test_account_peppol_migration.py create mode 100644 openupgrade_scripts/scripts/account_peppol/19.0.1.2/upgrade_analysis_work.txt diff --git a/docsource/modules180-190.rst b/docsource/modules180-190.rst index e7f797ce0766..f621fcab35bb 100644 --- a/docsource/modules180-190.rst +++ b/docsource/modules180-190.rst @@ -24,7 +24,7 @@ Module coverage 18.0 -> 19.0 +---------------------------------------------------+----------------------+-------------------------------------------------+ | account_payment |Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ -| account_peppol | | | +| account_peppol |Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ | |new| account_peppol_advanced_fields | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/account_peppol/19.0.1.2/pre-migration.py b/openupgrade_scripts/scripts/account_peppol/19.0.1.2/pre-migration.py new file mode 100644 index 000000000000..1eddffcc8065 --- /dev/null +++ b/openupgrade_scripts/scripts/account_peppol/19.0.1.2/pre-migration.py @@ -0,0 +1,10 @@ +from openupgradelib import openupgrade + +_renamed_models = [("account_peppol.service.wizard", "peppol.config.wizard")] +_renamed_tables = [("account_peppol_service_wizard", "peppol_config_wizard")] + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.rename_models(env.cr, _renamed_models) + openupgrade.rename_tables(env.cr, _renamed_tables) diff --git a/openupgrade_scripts/scripts/account_peppol/19.0.1.2/tests/test_account_peppol_migration.py b/openupgrade_scripts/scripts/account_peppol/19.0.1.2/tests/test_account_peppol_migration.py new file mode 100644 index 000000000000..f60ea88884ee --- /dev/null +++ b/openupgrade_scripts/scripts/account_peppol/19.0.1.2/tests/test_account_peppol_migration.py @@ -0,0 +1,27 @@ +from odoo.tests import TransactionCase + +from odoo.addons.openupgrade_framework import openupgrade_test + + +@openupgrade_test +class TestAccountPeppolMigration(TransactionCase): + def test_wizard_model_renamed(self): + """account_peppol.service.wizard (transient) renamed to + peppol.config.wizard. rename_models + rename_tables in pre-migration + keeps ir_model / ir_model_data consistent. + """ + self.assertIn("peppol.config.wizard", self.env.registry) + self.assertNotIn("account_peppol.service.wizard", self.env.registry) + + def test_wizard_table_renamed(self): + """The postgres table for the renamed transient model must exist + under the new name (transients have tables even though rows are + cleared periodically). + """ + self.env.cr.execute( + """ + SELECT 1 FROM information_schema.tables + WHERE table_name = 'peppol_config_wizard' + """ + ) + self.assertTrue(self.env.cr.fetchone()) diff --git a/openupgrade_scripts/scripts/account_peppol/19.0.1.2/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/account_peppol/19.0.1.2/upgrade_analysis_work.txt new file mode 100644 index 000000000000..79e7b7f89378 --- /dev/null +++ b/openupgrade_scripts/scripts/account_peppol/19.0.1.2/upgrade_analysis_work.txt @@ -0,0 +1,36 @@ +---Models in module 'account_peppol'--- +obsolete model account_peppol.service.wizard (renamed to peppol.config.wizard) [transient] +new model peppol.config.wizard (renamed from account_peppol.service.wizard) [transient] + +# DONE: pre-migration: rename_models + rename_tables (transient wizard) + +---Fields in module 'account_peppol'--- +account_peppol / account_edi_proxy_client.user / peppol_verification_code (char): DEL +account_peppol / res.company / account_peppol_proxy_state (selection): selection_keys removed: [in_verification] +account_peppol / res.company / peppol_activate_self_billing_sending (boolean): NEW +account_peppol / res.company / peppol_external_provider (char): NEW +account_peppol / res.company / peppol_metadata (json) : NEW +account_peppol / res.company / peppol_metadata_updated_at (datetime): NEW +account_peppol / res.company / peppol_self_billing_reception_journal_id (many2one): NEW relation: account.journal, isfunction: function, stored +account_peppol_selfbilling / account.journal / is_self_billing (boolean) : module is now 'account' ('account_peppol_selfbilling') + +# NOTHING TO DO + +---XML records in module 'account_peppol'--- +NEW ir.actions.client: account_peppol.action_peppol_auth_callback +NEW ir.cron: account_peppol.ir_cron_peppol_webhook_keepalive +NEW ir.model.access: account_peppol.access_peppol_config_wizard +DEL ir.model.access: account_peppol.account_peppol_service_wizard_system +NEW ir.ui.view: account_peppol.peppol_config_wizard_form +NEW ir.ui.view: account_peppol.portal_my_details +DEL ir.ui.view: account_peppol.account_journal_dashboard_kanban_view +DEL ir.ui.view: account_peppol.peppol_service_configuration +DEL ir.ui.view: account_peppol.portal_my_details_fields +DEL ir.ui.view: account_peppol_selfbilling.account_move_form_inherit_self_billing +DEL ir.ui.view: account_peppol_selfbilling.report_invoice_document +DEL ir.ui.view: account_peppol_selfbilling.view_account_journal_form_inherited +NEW mail.template: account_peppol.mail_template_peppol_registration +DEL mail.template: account_peppol_selfbilling.email_template_edi_self_billing_credit_note [renamed to account module] (noupdate) +DEL mail.template: account_peppol_selfbilling.email_template_edi_self_billing_invoice [renamed to account module] (noupdate) + +# NOTHING TO DO