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

[16.0][FIX] shopfloor: fix create return move and move lines sort #953

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions shopfloor/actions/move_line_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ def _sort_key_move_lines_priority(self, line):
# make prority negative to keep sorting ascending
return self._sort_key_assigned_to_current_user(line) + (
-int(line.move_id.priority or "0"),
line.move_id.date,
line.move_id.date if line.move_id else line.create_date,
line.move_id.id,
)

def _sort_key_move_lines_location(self, line):
return self._sort_key_assigned_to_current_user(line) + (
line.location_id.shopfloor_picking_sequence or "",
line.location_id.name,
line.move_id.date,
line.move_id.date if line.move_id else line.create_date,
line.move_id.id,
)

Expand Down
6 changes: 3 additions & 3 deletions shopfloor/actions/stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
def _create_return_move__get_max_qty(self, origin_move):
"""Returns the max returneable qty."""
# The max returnable qty is the sent qty minus the already returned qties
quantity = origin_move.reserved_qty
quantity = origin_move.product_uom_qty

Check warning on line 21 in shopfloor/actions/stock.py

View check run for this annotation

Codecov / codecov/patch

shopfloor/actions/stock.py#L21

Added line #L21 was not covered by tests
for move in origin_move.move_dest_ids:
if (
move.origin_returned_move_id
Expand All @@ -28,7 +28,7 @@
if move.state in ("partially_available", "assigned"):
quantity -= sum(move.move_line_ids.mapped("reserved_qty"))
elif move.state in ("done"):
quantity -= move.reserved_qty
quantity -= move.product_uom_qty

Check warning on line 31 in shopfloor/actions/stock.py

View check run for this annotation

Codecov / codecov/patch

shopfloor/actions/stock.py#L31

Added line #L31 was not covered by tests
return float_round(
quantity, precision_rounding=origin_move.product_id.uom_id.rounding
)
Expand Down Expand Up @@ -92,7 +92,7 @@
def _create_return_picking__get_vals(self, return_types, origin):
return_type = fields.first(return_types)
return {
"move_lines": [],
"move_ids": [],
"picking_type_id": return_type.id,
"state": "draft",
"origin": origin,
Expand Down
Loading