Fix access rights in product_print_zpl_barcode

In odoo v14, read of ir.actions.act_windows is restricted to base.group_system
This commit is contained in:
Alexis de Lattre
2021-02-03 18:05:03 +01:00
parent 0d4ff37786
commit 45d734badf
2 changed files with 3 additions and 3 deletions

View File

@@ -35,7 +35,7 @@ class ProductTemplate(models.Model):
"because it has %d variants and not just one.") "because it has %d variants and not just one.")
% (self.display_name, self.product_variant_count)) % (self.display_name, self.product_variant_count))
action = self.env.ref( action = self.env.ref(
'product_print_zpl_barcode.product_print_zpl_barcode_action').read()[0] 'product_print_zpl_barcode.product_print_zpl_barcode_action').sudo().read()[0]
action['context'] = { action['context'] = {
'active_id': self.product_variant_ids[0].id, 'active_id': self.product_variant_ids[0].id,
'active_model': 'product.product', 'active_model': 'product.product',

View File

@@ -270,7 +270,7 @@ class ProductPrintZplBarcode(models.TransientModel):
'zpl_filename': 'barcode_%s.zpl' % vals['barcode'], 'zpl_filename': 'barcode_%s.zpl' % vals['barcode'],
}) })
self.write(vals) self.write(vals)
action = self.env.ref('product_print_zpl_barcode.product_print_zpl_barcode_action').read()[0] action = self.env.ref('product_print_zpl_barcode.product_print_zpl_barcode_action').sudo().read()[0]
action.update({ action.update({
'res_id': self.id, 'res_id': self.id,
'context': self._context, 'context': self._context,
@@ -285,7 +285,7 @@ class ProductPrintZplBarcode(models.TransientModel):
self.zpl_filename, base64.decodebytes(self.zpl_file), format='raw') self.zpl_filename, base64.decodebytes(self.zpl_file), format='raw')
action = True action = True
if self._context.get('print_and_new'): if self._context.get('print_and_new'):
action = self.env.ref('product_print_zpl_barcode.product_print_zpl_barcode_action').read()[0] action = self.env.ref('product_print_zpl_barcode.product_print_zpl_barcode_action').sudo().read()[0]
action.update({ action.update({
'views': False, 'views': False,
'context': self._context, 'context': self._context,