From 3101feb4941f86cbcf85451d9e3cfbf5c2fc340c Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Tue, 14 Apr 2020 12:55:49 +0000 Subject: [PATCH] [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) --- addons/stock/models/res_config_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/res_config_settings.py b/addons/stock/models/res_config_settings.py index 8feb5c42831..886c24a48a3 100644 --- a/addons/stock/models/res_config_settings.py +++ b/addons/stock/models/res_config_settings.py @@ -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