[FIX] stock: fix production_lot settings
For existing users who had previously disabled the "Lots & Serial Numbers" settings, by applying this fix: https://github.com/odoo/odoo/pull/138907/commits/376ee1289eba840f1d8b2b6149d933bdedd47518 They will get the user error each time they try to access the settings. Therefore, we prefer to prevent this and trigger the error only when necessary. opw-3452946 closes odoo/odoo#141921 X-original-commit: 608439b09cb68409dec10427d5b927ce0a27d526 Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user