[IMP] stock_picking_batch_custom: keep the weighed quantity on the operator view
Basket Assembly is where the reverting quantity was noticed, so it depends on stock_move_manual_quantity now and its two lists load `picked`: the web client only saves the fields present in the arch, and without it the onchange that freezes a hand-typed quantity never reaches the server. Collecting a line does the same, minus the demand. It is the operator saying the goods are in the basket, so the quantity has to survive the reservation engine even when it was never retyped -- but only a quantity typed by hand says what the demand should become, and a line collected at zero would otherwise lose its demand and be cancelled on validation. Drops views/stock_move_line_views.xml on the way. It declared a second record under the id stock_picking_batch_views.xml already uses, so it was loaded first and immediately overwritten: dead weight that would have turned into a duplicate-field view had anyone renamed it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
d433e50f2f
commit
2e7549f857
7 changed files with 103 additions and 37 deletions
|
|
@ -47,6 +47,21 @@ class StockMoveLine(models.Model):
|
|||
readonly=True,
|
||||
)
|
||||
|
||||
def write(self, vals):
|
||||
res = super().write(vals)
|
||||
if vals.get("is_collected"):
|
||||
# Collecting a line is the operator saying the goods are in the
|
||||
# basket: its quantity must survive the reservation engine even if
|
||||
# it was never retyped. The demand is left alone, only a quantity
|
||||
# typed by hand adjusts it.
|
||||
lines = self.filtered(
|
||||
lambda line: not line.picked and line.state not in ("done", "cancel")
|
||||
)
|
||||
if lines:
|
||||
lines.picked = True
|
||||
lines._freeze_manual_quantity(align_demand=False)
|
||||
return res
|
||||
|
||||
@api.depends("picking_id")
|
||||
def _compute_consumer_group_id(self):
|
||||
for line in self:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue