diff --git a/shopfloor/actions/move_line_search.py b/shopfloor/actions/move_line_search.py index a608652ccd..18cdf128bd 100644 --- a/shopfloor/actions/move_line_search.py +++ b/shopfloor/actions/move_line_search.py @@ -161,7 +161,7 @@ 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, ) @@ -169,7 +169,7 @@ 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, ) diff --git a/shopfloor/actions/stock.py b/shopfloor/actions/stock.py index ba34b36ab9..ee4a810b6c 100644 --- a/shopfloor/actions/stock.py +++ b/shopfloor/actions/stock.py @@ -18,7 +18,7 @@ class StockAction(Component): 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 for move in origin_move.move_dest_ids: if ( move.origin_returned_move_id @@ -28,7 +28,7 @@ def _create_return_move__get_max_qty(self, origin_move): 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 return float_round( quantity, precision_rounding=origin_move.product_id.uom_id.rounding ) @@ -92,7 +92,7 @@ def create_return_move(self, return_picking, origin_moves): 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,