diff --git a/models/restricted_models.py b/models/restricted_models.py
index 51fb8a3..13741a4 100644
--- a/models/restricted_models.py
+++ b/models/restricted_models.py
@@ -26,15 +26,15 @@ class StockWarehouse(models.Model):
class StockPickingType(models.Model):
_inherit = 'stock.picking.type'
- @api.model
- def _search(self, domain, offset=0, limit=None, order=None, **kwargs):
- if self.env.context.get('bypass_user_restriction'):
- return super()._search(domain, offset=offset, limit=limit, order=order, **kwargs)
- if not self.env.su and not self.env.user.has_group('base.group_system'):
- allowed_ids = get_allowed_ids(self.env, 'res_users_stock_picking_type_rel', 'picking_type_id', self.env.user.id)
- if allowed_ids:
- domain = Domain(domain or []) & Domain([('id', 'in', allowed_ids)])
- return super()._search(domain, offset=offset, limit=limit, order=order, **kwargs)
+ # @api.model
+ # def _search(self, domain, offset=0, limit=None, order=None, **kwargs):
+ # if self.env.context.get('bypass_user_restriction'):
+ # return super()._search(domain, offset=offset, limit=limit, order=order, **kwargs)
+ # if not self.env.su and not self.env.user.has_group('base.group_system'):
+ # allowed_ids = get_allowed_ids(self.env, 'res_users_stock_picking_type_rel', 'picking_type_id', self.env.user.id)
+ # if allowed_ids:
+ # domain = Domain(domain or []) & Domain([('id', 'in', allowed_ids)])
+ # return super()._search(domain, offset=offset, limit=limit, order=order, **kwargs)
diff --git a/security/ir_rule.xml b/security/ir_rule.xml
index e0b4db7..44a08d9 100644
--- a/security/ir_rule.xml
+++ b/security/ir_rule.xml
@@ -28,7 +28,7 @@
(
[(1, '=', 1)] if user.env.context.get('bypass_user_restriction') or user.has_group('base.group_system') else
- [('id', 'in', user.allowed_picking_type_ids.ids)] if user.allowed_picking_type_ids else [(1, '=', 1)]
+ ['|', ('id', 'in', user.allowed_picking_type_ids.ids), ('warehouse_id', 'in', (user.allowed_warehouse_ids + user.allowed_location_ids.warehouse_id).ids)] if (user.allowed_picking_type_ids or user.allowed_warehouse_ids or user.allowed_location_ids) else [(1, '=', 1)]
)
@@ -41,7 +41,7 @@
(
[(1, '=', 1)] if user.env.context.get('bypass_user_restriction') or user.has_group('base.group_system') else
- ['|', '|', ('id', 'in', user.allowed_location_ids.ids), ('id', 'child_of', user.allowed_location_ids.ids), ('id', 'parent_of', user.allowed_location_ids.ids)] if user.allowed_location_ids else [(1, '=', 1)]
+ ['|', '|', '|', ('id', 'in', user.allowed_location_ids.ids), ('id', 'child_of', user.allowed_location_ids.ids), ('id', 'parent_of', user.allowed_location_ids.ids), ('warehouse_id', 'in', (user.allowed_warehouse_ids + user.allowed_location_ids.warehouse_id).ids)] if (user.allowed_location_ids or user.allowed_warehouse_ids) else [(1, '=', 1)]
)