[FIX] point_of_sale: sudo in _check_active if stock.picking.type
If the user has access to picking types as a stock manager without having access to pos config, deactivating a picking type triggers an AccessError on pos.config. closes odoo/odoo#156820 X-original-commit: 743c70e8d4e753200411aeedc8482c374792b1d5 Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
@@ -169,7 +169,7 @@ class StockPickingType(models.Model):
|
||||
@api.constrains('active')
|
||||
def _check_active(self):
|
||||
for picking_type in self:
|
||||
pos_config = self.env['pos.config'].search([('picking_type_id', '=', picking_type.id)], limit=1)
|
||||
pos_config = self.env['pos.config'].sudo().search([('picking_type_id', '=', picking_type.id)], limit=1)
|
||||
if pos_config:
|
||||
raise ValidationError(_("You cannot archive '%s' as it is used by a POS configuration '%s'.", picking_type.name, pos_config.name))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user