From df915d3ac4f37466a2883b0a372d5e74a66d750f Mon Sep 17 00:00:00 2001 From: Thierry Ducrest Date: Tue, 31 Oct 2023 13:36:38 +0100 Subject: [PATCH] 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. --- shopfloor/actions/data.py | 9 ++------- shopfloor/tests/test_actions_data.py | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/shopfloor/actions/data.py b/shopfloor/actions/data.py index aaefbc06dc..be234fd92a 100644 --- a/shopfloor/actions/data.py +++ b/shopfloor/actions/data.py @@ -355,16 +355,11 @@ def _get_operation_progress(self, domain): lines = self.env["stock.move.line"].search(domain) # operations_to_do = number of total operations that are pending for this location. # operations_done = number of operations already done. - # A line with an assigned package counts as 1 operation. operations_to_do = 0 operations_done = 0 for line in lines: - is_done = line.qty_done == line.product_uom_qty - package_qty_done = 1 if is_done else 0 - operations_done += ( - line.qty_done if not line.package_id else package_qty_done - ) - operations_to_do += line.product_uom_qty if not line.package_id else 1 + operations_done += line.qty_done + operations_to_do += line.product_uom_qty - line.qty_done return { "done": operations_done, "to_do": operations_to_do, diff --git a/shopfloor/tests/test_actions_data.py b/shopfloor/tests/test_actions_data.py index 0fbe90233e..f6b1d8a5b2 100644 --- a/shopfloor/tests/test_actions_data.py +++ b/shopfloor/tests/test_actions_data.py @@ -51,7 +51,7 @@ def test_data_location_with_operation_progress(self): "barcode": location.name, "operation_progress": { "done": 16.0, - "to_do": 165.0, + "to_do": 167.0, }, } self.assertDictEqual(data, expected)