[IMP] stock_picking_batch_collect: demanded quantity on the move line lists
The move lists already show the demand, the move line ones do not: the detailed operations of the batch and of the transfer, and the operator (Basket Assembly) view. Adds a read-only column with the demand of the line's move, in the unit of the line, next to the ordered quantity. Closes #21 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fac8299c9c
commit
18cfd38347
11 changed files with 93 additions and 1 deletions
|
|
@ -41,6 +41,11 @@ class StockMoveLine(models.Model):
|
|||
digits="Product Unit of Measure",
|
||||
compute="_compute_sale_ordered_qty",
|
||||
)
|
||||
move_demand_qty = fields.Float(
|
||||
string="Demanded Quantity",
|
||||
digits="Product Unit of Measure",
|
||||
compute="_compute_move_demand_qty",
|
||||
)
|
||||
|
||||
@api.depends("move_id.sale_ordered_qty", "move_id.product_uom", "product_uom_id")
|
||||
def _compute_sale_ordered_qty(self):
|
||||
|
|
@ -53,6 +58,18 @@ class StockMoveLine(models.Model):
|
|||
else:
|
||||
line.sale_ordered_qty = 0.0
|
||||
|
||||
@api.depends("move_id.product_uom_qty", "move_id.product_uom", "product_uom_id")
|
||||
def _compute_move_demand_qty(self):
|
||||
"""The demand of the whole move: every line of a split move shows it."""
|
||||
for line in self:
|
||||
move = line.move_id
|
||||
if move.product_uom and line.product_uom_id:
|
||||
line.move_demand_qty = move.product_uom._compute_quantity(
|
||||
move.product_uom_qty, line.product_uom_id, round=False
|
||||
)
|
||||
else:
|
||||
line.move_demand_qty = 0.0
|
||||
|
||||
def write(self, vals):
|
||||
res = super().write(vals)
|
||||
if vals.get("is_collected"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue