[FIX] sale_stock_usability: fix order of lines in report method

This commit is contained in:
Alexis de Lattre
2025-01-06 11:22:48 +00:00
parent bec65a009f
commit 95b92d4027

View File

@@ -23,8 +23,10 @@ class StockPicking(models.Model):
total_amount = 0.0 total_amount = 0.0
total_weight_kg = 0.0 total_weight_kg = 0.0
lines = [] lines = []
for line in self.move_line_ids: # loop on stock.move AND THEN on stock.move.line to keep the order
move = line.move_id # of the sale order lines
for move in self.move_ids:
for line in move.move_line_ids:
uom = line.product_uom_id uom = line.product_uom_id
if uom.category_id.id == weight_uom_categ_id: if uom.category_id.id == weight_uom_categ_id:
weight_kg_subtotal = uom._compute_quantity(line.qty_done, kg_uom) weight_kg_subtotal = uom._compute_quantity(line.qty_done, kg_uom)