diff --git a/addons/stock/i18n/stock.pot b/addons/stock/i18n/stock.pot index c9302002735..0221234dc5a 100644 --- a/addons/stock/i18n/stock.pot +++ b/addons/stock/i18n/stock.pot @@ -10225,6 +10225,15 @@ msgstr "" msgid "You have processed less products than the initial demand." msgstr "" +#. module: stock +#. odoo-python +#: code:addons/stock/models/res_config_settings.py:0 +#, python-format +msgid "" +"You have product(s) in stock that have lot/serial number tracking enabled. \n" +"Switch off tracking on all the products before switching off this setting." +msgstr "" + #. module: stock #. odoo-python #: code:addons/stock/models/product.py:0 diff --git a/addons/stock/models/res_config_settings.py b/addons/stock/models/res_config_settings.py index 866c58e48e2..dec37d0bd2f 100644 --- a/addons/stock/models/res_config_settings.py +++ b/addons/stock/models/res_config_settings.py @@ -134,4 +134,8 @@ class ResConfigSettings(models.TransientModel): ('show_operations', '=', False) ]).show_operations = True + if not self.group_stock_production_lot and previous_group.get('group_stock_production_lot'): + if self.env['product.product'].search_count([('tracking', '!=', 'none')], limit=1): + raise UserError(_("You have product(s) in stock that have lot/serial number tracking enabled. \nSwitch off tracking on all the products before switching off this setting.")) + return