Add sudo() to access ir.actions.act_windows... stupid v14!

This commit is contained in:
Alexis de Lattre
2021-04-14 08:13:53 +02:00
parent 452cc399c5
commit dff4e47cf5

View File

@@ -15,7 +15,7 @@ class ProductTemplate(models.Model):
type = fields.Selection(default='product')
def action_view_stock_move(self):
action = self.env.ref('stock.stock_move_action').read()[0]
action = self.env.ref('stock.stock_move_action').sudo().read()[0]
action['domain'] = [('product_id.product_tmpl_id', 'in', self.ids)]
action['context'] = {'search_default_done': True}
return action
@@ -25,7 +25,7 @@ class ProductProduct(models.Model):
_inherit = 'product.product'
def action_view_stock_move(self):
action = self.env.ref('stock.stock_move_action').read()[0]
action = self.env.ref('stock.stock_move_action').sudo().read()[0]
action['domain'] = [('product_id', 'in', self.ids)]
action['context'] = {'search_default_done': True}
return action