Skip to content

[19.0][FIX] ddmrp: repair three silent migration regressions (ADU UoM, UoM guard, stock.reference)#4

Closed
dnplkndll wants to merge 3 commits into
19.0from
19.0-fix-mig-regressions
Closed

[19.0][FIX] ddmrp: repair three silent migration regressions (ADU UoM, UoM guard, stock.reference)#4
dnplkndll wants to merge 3 commits into
19.0from
19.0-fix-mig-regressions

Conversation

@dnplkndll

@dnplkndll dnplkndll commented Jun 11, 2026

Copy link
Copy Markdown

Repairs three defects in the 19.0 ddmrp base, found in a review pass ahead of migrating the remaining 18.0→19.0 module gap. All three passed CI silently — each commit carries a regression test.

  1. Future ADU aggregated in the wrong UoM_calc_adu_future_demand summed product_uom_qty (move UoM) instead of product_qty (product UoM, what 18.0 aggregated): a future delivery of 5 Dozen contributed 5, not 60, to ADU → undersized buffers. Tests only used Units, so nothing failed.
  2. Unreachable product-UoM-change guard removed_check_buffer_procure_uom can never raise: procure_uom_id is a stored compute depending on the product UoM, so a template-UoM write re-derives every buffer's procurement UoM before the constraint reads it (verified live: CI run of an earlier revision with a corrected predicate still couldn't make it fire). The 19.0 predicate (_compute_quantity(..., raise_if_failure=False), which never fails) was doubly inert. The effective guards — the auto-follow recompute, buffer-side _check_procure_uom, and the valid_uom_ids domain — stay; the new test pins the auto-follow behavior.
  3. group_id mechanically renamed to stock.rule — core 19 removed procurement.group; the comodel swap left a "Procurement Group" picker listing stock rules and a group_id values key nothing consumes (core consumes values["reference_ids"] and groups pickings by reference_ids). Retargeted to stock.reference and the key renamed, restoring the 18.0 grouping behavior.

Companion to #3 (test_04 weekend-flake fix). Fork validation before any upstream filing.

The 19.0 migration switched _calc_adu_future_demand from summing
product_qty (product UoM) to product_uom_qty (move UoM). A confirmed
future delivery of 5 Dozen then contributed 5 instead of 60 to the ADU,
undersizing buffers for any non-unit secondary UoM. The past-demand path
already aggregates in product UoM (quantity_product_uom).
_check_buffer_procure_uom can never raise: procure_uom_id is a stored
compute depending on the product UoM, so writing a new UoM on the
template re-derives every buffer's procurement UoM before the
constraint reads it — an incompatible pair is unobservable. On top of
that, its 19.0 predicate (_compute_quantity with raise_if_failure=False,
which never fails) was doubly inert. The auto-follow recompute plus the
buffer-side _check_procure_uom constraint and the valid_uom_ids view
domain are the effective guards; pin the auto-follow behavior with a
test instead.
The 19.0 migration renamed the group_id comodel from the removed
procurement.group to stock.rule, leaving a "Procurement Group" picker
that lists stock rules and a group_id procurement-values key that
nothing consumes. Core 19 groups moves and pickings by stock.reference
(values["reference_ids"] in stock.rule._get_stock_move_values,
reference_ids in _search_picking_for_assignation_domain), so point the
field there and emit reference_ids to restore the grouping behavior.
@dnplkndll

Copy link
Copy Markdown
Author

Superseded — split into one-concern PRs per upstream convention: ADU UoM → #6 (upstream as OCA#612), stock.reference retarget → #16, dead UoM-guard removal → #17. Branch kept; the ledoent integration branch carries the same content.

@dnplkndll dnplkndll closed this Jun 12, 2026
@dnplkndll dnplkndll deleted the 19.0-fix-mig-regressions branch June 15, 2026 14:27
dnplkndll added a commit that referenced this pull request Jul 7, 2026
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