[FIX] stock: Creating operation type as Administrator

Steps to reproduce the bug:

- Let's consider a user U with access rights Inventory Amdinistrator
- Try to create an operation type with U

Bug:

An access error was raised because U has no rights to create an ir.sequence
record.

opw:2381272

closes odoo/odoo#61966

X-original-commit: 472fc28255ad29bcaaa7bd2f68a64018361b2665
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2020-11-18 17:10:31 +00:00
parent 28762b79e3
commit 10c6fb1d69
+1 -1
View File
@@ -83,7 +83,7 @@ class PickingType(models.Model):
if 'sequence_id' not in vals or not vals['sequence_id']:
if vals['warehouse_id']:
wh = self.env['stock.warehouse'].browse(vals['warehouse_id'])
vals['sequence_id'] = self.env['ir.sequence'].create({
vals['sequence_id'] = self.env['ir.sequence'].sudo().create({
'name': wh.name + ' ' + _('Sequence') + ' ' + vals['sequence_code'],
'prefix': wh.code + '/' + vals['sequence_code'] + '/', 'padding': 5,
'company_id': wh.company_id.id,