[FIX] stock: bypass permission check after settings change

Install Accounting(account_accountant), Inventory (stock)
1. Create a new user [DEMO] with the next access:
- Accounting: Advisor
- Administration: Settings
2. With the user [DEMO] , go to Accounting>Configuration>Settings
and change any value.
3. Try to save the settings.

Access error will occur "Sorry, you are not allowed to modify documents
of type 'Picking Type' (stock.picking.type)..."
This occur because when stock is installed an override in 'execute' make
the backend check for multi locations, packaging or tracking settings
and activate show_operation on stock.picking.type causing the access
error for unprivileged users
Calling the write with sudo solve the issue

opw-2233193

closes odoo/odoo#49555

X-original-commit: f560a9966dfbbacb259f0de74437743d1385d8a6
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2020-04-14 15:12:44 +00:00
parent 7076b4f4d0
commit 3101feb494
+1 -1
View File
@@ -94,5 +94,5 @@ class ResConfigSettings(models.TransientModel):
('code', '!=', 'incoming'),
('show_operations', '=', False)
])
picking_types.write({'show_operations': True})
picking_types.sudo().write({'show_operations': True})
return res