Skip to content

[15.0][OU-FIX] hr_expense: fix account.move and lines of migrated expenses#11

Open
eantones wants to merge 4 commits into
15.0from
15.0-ou-fix-hr_expense
Open

[15.0][OU-FIX] hr_expense: fix account.move and lines of migrated expenses#11
eantones wants to merge 4 commits into
15.0from
15.0-ou-fix-hr_expense

Conversation

@eantones

@eantones eantones commented Jul 12, 2026

Copy link
Copy Markdown
Member

Split of #3 (hr_expense part). Disjoint file set: openupgrade_scripts/scripts/hr_expense/15.0.2.0/post-migration.py only.

Content labels (composable): oca-candidate + oca-cherry-pick — each commit subject says which it is:

commit prefix author nature
1 [OCA-CHERRY-PICK OCA#4577] hugues de keyzer pending OCA work, original authorship preserved
2 [OCA-CHERRY-PICK OCA#4577] Rémy Taymans pending OCA work, original authorship preserved
3 [OCA-CANDIDATE] Eric Antones ours, stacked on the picks (same file — inseparable from them)
4 [OCA-CANDIDATE] Eric Antones ours, stacked on the picks

Submit plan: the four commits form ONE combined fix; at submit time propose the final state to OCA (coordinating with OCA PR 4577 — if it merges first, rebase and submit only our two on top).

@eantones eantones added the oca-candidate Contains commits of ours that will be proposed to OCA at submit time. label Jul 12, 2026
@eantones eantones added the oca-cherry-pick Contains commits cherry-picked from open OCA PRs (already proposed upstream by their author). label Jul 12, 2026
@eantones eantones force-pushed the 15.0-ou-fix-hr_expense branch from 065dd20 to 86fa4d5 Compare July 12, 2026 21:23
huguesdk and others added 4 commits July 12, 2026 23:45
…ines

fix the value of several fields on account.move and account.move.line
records linked to hr.expense records.

Co-authored-by: Miquel Raïch <miquel.raich@forgeflow.com>
fiscalyear_lock_date check prevent modifying old move, but some field
should be recomputed to be correct in 15.0.
…k during amount recompute

The payment_state rework picked from OCA#4577 rebuilt _fill_payment_state
keeping only the fiscalyear_lock_date bypass, dropping the reconciliation
bypass that 4ac3a16 had introduced for the same _compute_amount() pass.
On databases where a reconciled expense move's recomputed amount_total
disagrees with its stored line balances, the recompute fires
_inverse_amount_total -> write() on reconciled lines -> UserError, aborting
the whole 14->15 upgrade. Restore the upstream-merged double bypass.
…ecting, drop reconciliation bypass

The double-bypass approach (4ac3a16, restored in 00451f1) lets the bare
_compute_amount() call fire _inverse_amount_total through Field.__set__ ->
write(): on reconciled 2-line expense moves whose recomputed amount_total
is 0, the inverse rewrites both lines' debit/credit to zero — silent data
corruption on reconciled entries (caught by a pre/post CSV audit: 828
mutated lines on a real 14.0 database). The reconciliation check that
4ac3a16 disables was the guard refusing exactly that write.

Run the compute under env.protecting() instead: assignments land in the
cache, flush() persists them by SQL, the inverse never fires, and no
lock-date or reconciliation check is triggered — so the fiscalyear bypass
and the reconciliation bypass both become unnecessary. Amounts follow the
lines, never the other way around.
@eantones eantones force-pushed the 15.0-ou-fix-hr_expense branch from 86fa4d5 to 9cdb7a6 Compare July 12, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

oca-candidate Contains commits of ours that will be proposed to OCA at submit time. oca-cherry-pick Contains commits cherry-picked from open OCA PRs (already proposed upstream by their author).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants