[19.0][OU-FIX] account_edi_ubl_cii: guard map_values when source column is absent#5716
[19.0][OU-FIX] account_edi_ubl_cii: guard map_values when source column is absent#5716mvalee wants to merge 4 commits into
Conversation
| _reason_code_map, | ||
| table="account_tax", | ||
| ) | ||
| # The ``ubl_cii_tax_exemption_reason_code`` column is not present on every |
There was a problem hiding this comment.
how can this happen? that's more interesting than the generated bullshit below
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
so please write a condensed version of this in the comment, and delete the rest
There was a problem hiding this comment.
@mvalee could you please update the comment so that it can be merged ?
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Problem
The
account_edi_ubl_cii19.0 pre-migration script callsopenupgrade.map_values()on
account_tax.ubl_cii_tax_exemption_reason_code, but that column is not presenton every 18.0 database (e.g. Community installs that never stored it). On such a DB
the migration aborts:
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 absentthere 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 all18.0 -> 19.0 upgrade completes on a Community databasethat lacks the column (176 modules loaded), with data and accounting balances intact.