File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
stock_inventory_lockdown/models Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,12 @@ def _get_dest_locations(self):
1818 self .ensure_one ()
1919 return self .move_line_ids .mapped ("location_dest_id" )
2020
21+ def _location_usage_without_restriction (self , move_line ):
22+ return (
23+ move_line .location_dest_id .usage == "inventory"
24+ or move_line .location_id .usage == "inventory"
25+ )
26+
2127 @api .constrains ("location_dest_id" , "location_id" , "state" )
2228 def _check_locked_location (self ):
2329 for move_line in self .filtered (lambda m : m .state == "done" ):
@@ -26,11 +32,8 @@ def _check_locked_location(self):
2632 ]._get_locations_open_inventories (
2733 [move_line .location_dest_id .id , move_line .location_id .id ]
2834 )
29- if locked_location_ids and not any (
30- [
31- move_line .location_dest_id .usage == "inventory" ,
32- move_line .location_id .usage == "inventory" ,
33- ]
35+ if locked_location_ids and not self ._location_usage_without_restriction (
36+ move_line
3437 ):
3538 location_names = locked_location_ids .mapped ("complete_name" )
3639 raise ValidationError (
You can’t perform that action at this time.
0 commit comments