Skip to content

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

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 label/description swap to PT companies#6
eantones wants to merge 2 commits into
17.0from
17.0-fix-ptplus-tax_label_swap_scope

Conversation

@eantones

@eantones eantones commented Aug 5, 2026

Copy link
Copy Markdown
Member

Replaces #2, auto-closed by GitHub at the instant the fork base 17.0 was resynced to the vendor's new snapshot (the mirror publishes force-pushed orphan snapshots; a PR does not survive the jump regardless of push order — reopen is refused afterwards).

Same two commits, rebased clean onto snapshot ac8eba5d: (1) scope the 17.0 label/description swap to PT companies only (the vendor migration flattened per-language labels of non-PT taxes; 30/164 PT taxes lost their es_ES variant), (2) make the swap one SQL UPDATE over the whole translation jsonb (unit-proven byte-exact per language on a 08-v16-done clone). Local-only.

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