From 7c19f5db753cdebc718c4483494d029ecd0f42b6 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 11 Nov 2026 17:00:01 +0100 Subject: [PATCH] [MIG] account_tax_python --- docsource/modules170-180.rst | 2 +- .../18.0.1.0/pre-migration.py | 25 +++++++++++++++++++ .../18.0.1.0/upgrade_analysis_work.txt | 12 +++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 openupgrade_scripts/scripts/account_tax_python/18.0.1.0/pre-migration.py create mode 100644 openupgrade_scripts/scripts/account_tax_python/18.0.1.0/upgrade_analysis_work.txt diff --git a/docsource/modules170-180.rst b/docsource/modules170-180.rst index b24c9b03388d..941447065b76 100644 --- a/docsource/modules170-180.rst +++ b/docsource/modules170-180.rst @@ -42,7 +42,7 @@ Module coverage 17.0 -> 18.0 +---------------------------------------------------+----------------------+-------------------------------------------------+ | account_qr_code_sepa |Nothing to do | | +---------------------------------------------------+----------------------+-------------------------------------------------+ -| account_tax_python | | | +| account_tax_python |Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ | account_update_tax_tags | |No DB layout changes. | +---------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/account_tax_python/18.0.1.0/pre-migration.py b/openupgrade_scripts/scripts/account_tax_python/18.0.1.0/pre-migration.py new file mode 100644 index 000000000000..bb3fddbc6eb4 --- /dev/null +++ b/openupgrade_scripts/scripts/account_tax_python/18.0.1.0/pre-migration.py @@ -0,0 +1,25 @@ +# Copyright 2026 Hunki Enterprises BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + if not openupgrade.column_exists(env.cr, "account_tax", "formula"): + # don't break if some OU user already created the column, then + # we assume they took care of the transformation too + openupgrade.copy_columns( + env.cr, + { + "account_tax": [("python_compute", "formula", None)], + }, + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE account_tax + SET formula=regexp_replace(formula, '\\s*result\\s*=\\s*', '') + WHERE formula IS NOT NULL + """, + ) diff --git a/openupgrade_scripts/scripts/account_tax_python/18.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/account_tax_python/18.0.1.0/upgrade_analysis_work.txt new file mode 100644 index 000000000000..3da866858289 --- /dev/null +++ b/openupgrade_scripts/scripts/account_tax_python/18.0.1.0/upgrade_analysis_work.txt @@ -0,0 +1,12 @@ +---Models in module 'account_tax_python'--- +---Fields in module 'account_tax_python'--- +account_tax_python / account.tax / formula (text) : NEW hasdefault: default +# DONE: renamed from python_compute in pre-migration + +account_tax_python / account.tax / python_applicable (text) : DEL +# NOTHING TO DO + +account_tax_python / account.tax / python_compute (text) : DEL +# DONE: renamed to formula in pre-migration + +---XML records in module 'account_tax_python'---