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

[IMP] Allow to plug custom messages for scan_location when some new_moves are not assigned #12

Open
wants to merge 1 commit into
base: 14.0
Choose a base branch
from
Open
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
12 changes: 8 additions & 4 deletions shopfloor/services/location_content_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,10 @@ def scan_location(self, barcode):
)
new_moves._action_confirm(merge=False)
new_moves._action_assign()
if not all([x.state == "assigned" for x in new_moves]):
unassigned_moves_message = self._check_moves_assignation(new_moves)
if unassigned_moves_message:
savepoint.rollback()
return self._response_for_start(
message=self.msg_store.new_move_lines_not_assigned()
)
return self._response_for_start(message=unassigned_moves_message)
pickings = new_moves.mapped("picking_id")
move_lines = new_moves.move_line_ids
for move_line in move_lines:
Expand Down Expand Up @@ -402,6 +401,11 @@ def scan_location(self, barcode):

return self._router_single_or_all_destination(pickings)

def _check_moves_assignation(self, new_moves):
if not all([x.state == "assigned" for x in new_moves]):
return self.msg_store.new_move_lines_not_assigned()
return False

def _find_transfer_move_lines_domain(self, location):
return [
("location_id", "=", location.id),
Expand Down