Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] shopfloor: fix progress computation #778

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading