Skip to content

[19.0][OU-FIX] account_edi_ubl_cii: guard map_values when source column is absent#5716

Open
mvalee wants to merge 4 commits into
OCA:19.0from
mvalee:19.0-ou-fix-account_edi_ubl_cii-guard
Open

[19.0][OU-FIX] account_edi_ubl_cii: guard map_values when source column is absent#5716
mvalee wants to merge 4 commits into
OCA:19.0from
mvalee:19.0-ou-fix-account_edi_ubl_cii-guard

Conversation

@mvalee

@mvalee mvalee commented Jun 13, 2026

Copy link
Copy Markdown

Problem

The account_edi_ubl_cii 19.0 pre-migration script calls openupgrade.map_values()
on account_tax.ubl_cii_tax_exemption_reason_code, but that column is not present
on every 18.0 database
(e.g. Community installs that never stored it). On such a DB
the migration aborts:

psycopg2.errors.UndefinedColumn: column "ubl_cii_tax_exemption_reason_code" does not exist
ERROR ... OpenUpgrade: account_edi_ubl_cii: error in migration script
         .../account_edi_ubl_cii/19.0.1.0/pre-migration.py
CRITICAL ... Failed to initialize database `<db>`.

Because it runs during -u all, the whole 18.0 -> 19.0 upgrade fails, not just this module.

Hit while migrating a real Belgian Community 18.0 -> 19.0 database.

Fix

Guard the value remap with openupgrade.column_exists(). When the column is absent
there is nothing to remap, and the 19.0 module update creates it afterwards, so
skipping is correct (not a workaround).

Verification

With the guard, a full -u all 18.0 -> 19.0 upgrade completes on a Community database
that lacks the column (176 modules loaded), with data and accounting balances intact.

@OCA-git-bot OCA-git-bot added mod:openupgrade_scripts Module openupgrade_scripts series:19.0 labels Jun 13, 2026
@pedrobaeza pedrobaeza added this to the 19.0 milestone Jun 16, 2026
_reason_code_map,
table="account_tax",
)
# The ``ubl_cii_tax_exemption_reason_code`` column is not present on every

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

how can this happen? that's more interesting than the generated bullshit below

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hello,
I just had the case during my migration from 16 to 19.
In 18, the account_edi_ubl_cii module is auto-installed if you have the account module, while the account_edi_ubl_cii_tax_extension isn't.
In 19, the 2nd module was merged into the 1st one.
So if you had account_edi_ubl_cii but not account_edi_ubl_cii_tax_extension in 18, the column does not exist yet.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

so please write a condensed version of this in the comment, and delete the rest

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@mvalee could you please update the comment so that it can be merged ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

have adapted

mvalee and others added 2 commits June 17, 2026 20:52
@pedrobaeza pedrobaeza changed the title [OU-FIX] account_edi_ubl_cii: guard map_values when source column is absent [19.0][OU-FIX] account_edi_ubl_cii: guard map_values when source column is absent Jun 18, 2026
@pedrobaeza pedrobaeza requested a review from hbrunn June 18, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:openupgrade_scripts Module openupgrade_scripts series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants