[19.0][FIX] ddmrp: repair three silent migration regressions (ADU UoM, UoM guard, stock.reference)#4
Closed
dnplkndll wants to merge 3 commits into
Closed
[19.0][FIX] ddmrp: repair three silent migration regressions (ADU UoM, UoM guard, stock.reference)#4dnplkndll wants to merge 3 commits into
dnplkndll wants to merge 3 commits into
Conversation
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.
ad395cc to
18edf65
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repairs three defects in the 19.0
ddmrpbase, 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._calc_adu_future_demandsummedproduct_uom_qty(move UoM) instead ofproduct_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._check_buffer_procure_uomcan never raise:procure_uom_idis 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 thevalid_uom_idsdomain — stay; the new test pins the auto-follow behavior.group_idmechanically renamed tostock.rule— core 19 removedprocurement.group; the comodel swap left a "Procurement Group" picker listing stock rules and agroup_idvalues key nothing consumes (core consumesvalues["reference_ids"]and groups pickings byreference_ids). Retargeted tostock.referenceand the key renamed, restoring the 18.0 grouping behavior.Companion to #3 (test_04 weekend-flake fix). Fork validation before any upstream filing.