Skip to content

[17.0][FIX] ptplus: scope the 17.0 label/description swap to PT companies - #2

Open
eantones wants to merge 2 commits into
17.0from
17.0-fix-ptplus-tax_label_swap_scope
Open

[17.0][FIX] ptplus: scope the 17.0 label/description swap to PT companies#2
eantones wants to merge 2 commits into
17.0from
17.0-fix-ptplus-tax_label_swap_scope

Conversation

@eantones

Copy link
Copy Markdown
Member

The 17.0.4.4.0 pre-migration swaps invoice_label <-> description to restore the PT localization's semantics after OpenUpgrade's account 17.0.1.2 rename (description -> invoice_label). It runs on search([]) — every tax of every company — so on a multi-localization database it also swaps the taxes of non-Portuguese companies, wiping their invoice labels (invoice_label <- the freshly recreated, empty description field) and misplacing the label text in description.

Scope the swap to the companies actually running the Portuguese localization, identified by company country. chart_template is not usable at this point of the migration: vendor chart codes are not remapped yet and read NULL.

Found on a 14->18 migration of a multi-company DB (9 ES companies + 1 PT): after the 16->17 hop, invoice_label was NULL on all 2412 taxes. To be reported to the vendor (Exo) as well.

Note: the vendor mirror is bot-published with force-pushed orphan snapshots per release — when exo 17.0 head moves past 400562b, rebase this branch onto the new snapshot (rebase operativa; unrelated histories won't merge).

eantones added 2 commits July 28, 2026 12:26
The 17.0.4.4.0 pre-migration swaps invoice_label <-> description to
restore the PT localization's semantics after OpenUpgrade's account
17.0.1.2 rename (description -> invoice_label). It ran on search([]) --
every tax of every company -- so on a multi-localization database it
also swapped the taxes of non-Portuguese companies, wiping their
invoice labels (invoice_label <- the freshly recreated, empty
description field) and misplacing the label text in description.

Scope the swap to the companies actually running the Portuguese
localization, identified by company country. chart_template is not
usable at this point of the migration: vendor chart codes are not
remapped yet and read NULL.
The 17.0.4.4.0 swap used an ORM read/write pair (tax.description /
tax.invoice_label), which resolves translatable fields in the context
language only: every other language's variant is dropped on write. On a
14->18 migration 30 of 164 PT taxes carried a diverging es_ES label
variant ("RET 25%" vs "RF 25%" elsewhere) and lost it at this door -
surfaced by a per-language relocation audit, invisible to any
single-language comparison.

Replace the loop with one SQL UPDATE swapping the two jsonb columns
wholesale (the right-hand side of an UPDATE reads the OLD row values, so
the assignments are a true simultaneous swap), scoped to PT-country
companies as before. Unit-proven on a clone of the pre-door snapshot:
164/164 PT per-language signatures preserved byte-exact, PT invoice_label
emptied, 0 non-PT rows touched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant