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][FIX] shopfloor: checkout fix asking destination location #780

Merged
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
7 changes: 2 additions & 5 deletions shopfloor/services/checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -1404,11 +1404,8 @@ def done(self, picking_id, confirmation=False):
},
)
lines_done = self._lines_checkout_done(picking)
dest_location = picking.location_dest_id
child_locations = self.env["stock.location"].search(
[("id", "child_of", dest_location.id), ("usage", "!=", "view")]
)
if len(child_locations) > 0 and child_locations != dest_location:
dest_location = lines_done.move_id.location_dest_id
if len(dest_location) != 1 or dest_location.usage == "view":
return self._response_for_select_child_location(
picking,
)
Expand Down
28 changes: 27 additions & 1 deletion shopfloor/tests/test_checkout_done.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,34 @@ def test_done_partial_confirm(self):
"done", params={"picking_id": self.picking.id, "confirmation": True}
)

self.assertRecordValues(self.picking, [{"state": "assigned"}])
self.assertRecordValues(self.picking, [{"state": "done"}])

self.assert_response(
response,
next_state="select_document",
message=self.service.msg_store.transfer_done_success(self.picking),
data={"restrict_scan_first": False},
)

def test_done_ask_destination_location(self):
"""Check asking for destination location for view type location."""
view_location = (
self.env["stock.location"]
.sudo()
.create(
{
"name": "Test Location Usage View",
"location_id": self.picking.move_lines.location_dest_id.id,
"usage": "view",
}
)
)
self.picking.move_lines.location_dest_id = view_location
response = self.service.dispatch(
"done", params={"picking_id": self.picking.id, "confirmation": True}
)

self.assertRecordValues(self.picking, [{"state": "assigned"}])
self.assert_response(
response,
next_state="select_child_location",
Expand Down
Loading