Skip to content

Commit

Permalink
fixup! Add shopfloor_location_package_restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
TDu committed Sep 8, 2023
1 parent 4a5dd65 commit 282efe9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@ def _validate_destination(self, location, moves):
if location.package_restriction != "norestriction":
try:
moves._check_location_package_restriction(only_qty_done=False)
except ValidationError:
return self.msg_store.location_has_restrictions()
except ValidationError as ex:
# __import__("pdb").set_trace()
return {
"message_type": "error",
"body": ex.name,
}
# return self.msg_store.location_has_restrictions()
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def setUp(self):
self.service.work.current_picking_type = self.picking1.picking_type_id

def test_set_destination_location_package_restriction(self):
""""""
"""Check error restriction on location is properly forwarded to frontend."""
# Add a restriction on the location
self.packing_location.sudo().package_restriction = "singlepackage"
# Add a first package on the location
Expand All @@ -32,11 +32,19 @@ def test_set_destination_location_package_restriction(self):
"confirmation": False,
},
)
message = {
"message_type": "error",
"body": (
f"Only one package is allowed on the location "
f"{self.packing_location.display_name}.You cannot add "
f"the {move_line.package_id.name}, there is already {self.pack_1.name}."
),
}
self.assert_response_set_line_destination(
response,
self.zone_location,
picking_type,
move_line,
message=self.service.msg_store.location_has_restrictions(),
message=message,
qty_done=10.0,
)

0 comments on commit 282efe9

Please sign in to comment.