[FIX] stock: enable all "Show Detailed Operations" only once
When changing any option in Settings, the option "Show Detailed Operations" of almost all operations types will be enabled To reproduce the issue: (Use demo data) 1. Open the Operation Type "YourCompany: Delivery Orders" and ensure "Show Detailed Operations" is unchecked 2. In Settings, enable an option (e.g., "Default Access Rights") 3. Go back to the form of "YourCompany: Delivery Orders" Error: "Show Detailed Operations" is checked for no reason With this commit, "Show Detailed Operations" of almost all operations types will be directly enabled only if one of the three options (Lots & Serial Numbers, Storage Locations or Packages) is enabled and none of these options was enabled before. OPW-2514993 closes odoo/odoo#79843 X-original-commit: 5b165dee6dd61b9d681b0e7ba2bc339edb30c83b Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Adrien Widart <awt@odoo.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user