Skip to content

Commit

Permalink
Merge PR #778 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by jbaudoux
  • Loading branch information
OCA-git-bot committed Nov 21, 2023
2 parents 945bab0 + df915d3 commit a09672e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions shopfloor/actions/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion shopfloor/tests/test_actions_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a09672e

Please sign in to comment.