Skip to content

Commit df915d3

Browse files
committed
shopfloor: fix progress computation
Don't take into account if there is packages or not. Leads to wrong computation if not all lines have a package.
1 parent 724aca6 commit df915d3

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

Diff for: shopfloor/actions/data.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -355,16 +355,11 @@ def _get_operation_progress(self, domain):
355355
lines = self.env["stock.move.line"].search(domain)
356356
# operations_to_do = number of total operations that are pending for this location.
357357
# operations_done = number of operations already done.
358-
# A line with an assigned package counts as 1 operation.
359358
operations_to_do = 0
360359
operations_done = 0
361360
for line in lines:
362-
is_done = line.qty_done == line.product_uom_qty
363-
package_qty_done = 1 if is_done else 0
364-
operations_done += (
365-
line.qty_done if not line.package_id else package_qty_done
366-
)
367-
operations_to_do += line.product_uom_qty if not line.package_id else 1
361+
operations_done += line.qty_done
362+
operations_to_do += line.product_uom_qty - line.qty_done
368363
return {
369364
"done": operations_done,
370365
"to_do": operations_to_do,

Diff for: shopfloor/tests/test_actions_data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_data_location_with_operation_progress(self):
5151
"barcode": location.name,
5252
"operation_progress": {
5353
"done": 16.0,
54-
"to_do": 165.0,
54+
"to_do": 167.0,
5555
},
5656
}
5757
self.assertDictEqual(data, expected)

0 commit comments

Comments
 (0)