diff --git a/addons/stock/models/res_config_settings.py b/addons/stock/models/res_config_settings.py index cc1de7808c3..e7e90c5873f 100644 --- a/addons/stock/models/res_config_settings.py +++ b/addons/stock/models/res_config_settings.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import api, fields, models, _ +from odoo import api, fields, models, SUPERUSER_ID, _ from odoo.exceptions import UserError @@ -85,6 +85,7 @@ class ResConfigSettings(models.TransientModel): putaway_rules.write({'active': False}) previous_group = self.default_get(['group_stock_multi_locations', 'group_stock_production_lot', 'group_stock_tracking_lot']) + was_operations_showed = self.env['stock.picking.type'].with_user(SUPERUSER_ID)._default_show_operations() res = super(ResConfigSettings, self).set_values() if not self.user_has_groups('stock.group_stock_manager'): @@ -103,7 +104,7 @@ class ResConfigSettings(models.TransientModel): ('delivery_steps', '=', 'ship_only')] ).mapped('int_type_id').write({'active': False}) - if any(self[group] and not prev_value for group, prev_value in previous_group.items()): + if not was_operations_showed and self.env['stock.picking.type'].with_user(SUPERUSER_ID)._default_show_operations(): picking_types = self.env['stock.picking.type'].with_context(active_test=False).search([ ('code', '!=', 'incoming'), ('show_operations', '=', False)