Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docsource/modules170-180.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
Original file line number Diff line number Diff line change
@@ -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*', '')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reproduced on 17.0: result = base_amount * 0.10 (a parameter documented in the 17.0 field help) comes out as base_amount * 0.10, and in the probe on 18.0 it raised Malformed formula on first use since the name is now base. Would renaming base_amount to base here be acceptable, and perhaps logging the taxes whose code is still multi-statement? Minor: the pattern is unanchored, so my_result = …; result = my_result loses its first assignment.

WHERE formula IS NOT NULL
""",
)
Original file line number Diff line number Diff line change
@@ -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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this carry the reason (removed functionality)? Reproduced on 17.0: a tax with python_applicable set to result = False or result = price_unit > 500 was filtered out, and in the probe on 18.0 the migrated tax was charged, silently. 18.0 has no equivalent beyond a formula returning None, so I am not asking for a mapping, only whether a logged warning for non-default values would be in scope here.


account_tax_python / account.tax / python_compute (text) : DEL
# DONE: renamed to formula in pre-migration

---XML records in module 'account_tax_python'---
Loading