[FIX] mrp: settings user unable to save settings

Settings user is not able to access Bill of Material (mrp.bom) records
unless they have additional groups (account, inventory, manufacturing, ...)

This commit makes sure the operation is done in sudo so that any setting user
is able to save the settings.

Part-of: odoo/odoo#91909
This commit is contained in:
Victor Feyens
2022-06-23 23:48:30 +02:00
parent 1bd7c55b5d
commit d2fb479d31
+1 -1
View File
@@ -27,7 +27,7 @@ class ResConfigSettings(models.TransientModel):
super().set_values()
if not self.group_mrp_workorder_dependencies:
# Disabling this option should not interfere with currently planned productions
self.env['mrp.bom'].search([('allow_operation_dependencies', '=', True)]).allow_operation_dependencies = False
self.env['mrp.bom'].sudo().search([('allow_operation_dependencies', '=', True)]).allow_operation_dependencies = False
@api.onchange('use_manufacturing_lead')
def _onchange_use_manufacturing_lead(self):