Repository navigation
[18.0][MIG] account_tax_python #6094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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*', '') | ||
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| account_tax_python / account.tax / python_compute (text) : DEL | ||
| # DONE: renamed to formula in pre-migration | ||
|
|
||
| ---XML records in module 'account_tax_python'--- | ||
There was a problem hiding this comment.
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 asbase_amount * 0.10, and in the probe on 18.0 it raisedMalformed formulaon first use since the name is nowbase. Would renamingbase_amounttobasehere be acceptable, and perhaps logging the taxes whose code is still multi-statement? Minor: the pattern is unanchored, somy_result = …; result = my_resultloses its first assignment.