[19.0][FIX] stock_inventory: do not fail when core creates no move line #2651
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 208 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.320
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2651"
general
weight: 0.35
micheledic
Problem
Any
product.productimport that maps Quantity On Hand fails on every row whosevalue matches the current on-hand quantity — which, for a product being created, means
0, or simply an empty cell thatbase_importreads as0.0:Cause
Two changes in 19.0 combine:
1.
product.qty_availablegained an inverse (addons/stock/models/product.py:270). Itcreates a quant and applies it with
from_inverse_qty=Truein the context. In 17.0 and18.0 the field had no inverse at all, so this code path did not exist.
2.
stock.quant._apply_inventorynow skips move creation entirely for that case(
addons/stock/models/stock_quant.py:1008-1011):In 17.0 and 18.0 the loop had no such branch — a zero difference still produced a
zero-quantity move, so a move line always existed afterwards. That is the assumption
this module's override was written against.
With no move created, the override finds no move line and raises.
Fix
Skip the quant when core deliberately created no move, and keep raising everywhere else —
for a real inventory adjustment core still always creates one.
Tests
Two tests added, covering both sides of the branch: a product created with a zero
qty_available(no move expected) and with a non-zero one (move expected). The firstreproduces the failure on
19.0and passes with the fix; the second passes either way andguards against over-broad skipping.