diff --git a/addons/stock/i18n/stock.pot b/addons/stock/i18n/stock.pot index efed91a141d..1b57be5c2c4 100644 --- a/addons/stock/i18n/stock.pot +++ b/addons/stock/i18n/stock.pot @@ -3623,16 +3623,16 @@ msgstr "" #. module: stock #. odoo-python -#: code:addons/stock/models/product.py:0 +#: code:addons/stock/models/product.py:0 code:addons/stock/models/product.py:0 #, python-format msgid "Invalid domain operator %s" msgstr "" #. module: stock #. odoo-python -#: code:addons/stock/models/product.py:0 +#: code:addons/stock/models/product.py:0 code:addons/stock/models/product.py:0 #, python-format -msgid "Invalid domain right operand %s" +msgid "Invalid domain right operand '%s'. It must be of type Integer/Float" msgstr "" #. module: stock diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index 498096901e6..a2ee31828d4 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -353,7 +353,7 @@ class Product(models.Model): if operator not in ('<', '>', '=', '!=', '<=', '>='): raise UserError(_('Invalid domain operator %s', operator)) if not isinstance(value, (float, int)): - raise UserError(_('Invalid domain right operand %s', value)) + raise UserError(_("Invalid domain right operand '%s'. It must be of type Integer/Float", value)) # TODO: Still optimization possible when searching virtual quantities ids = [] @@ -366,6 +366,11 @@ class Product(models.Model): def _search_qty_available_new(self, operator, value, lot_id=False, owner_id=False, package_id=False): ''' Optimized method which doesn't search on stock.moves, only on stock.quants. ''' + if operator not in ('<', '>', '=', '!=', '<=', '>='): + raise UserError(_('Invalid domain operator %s', operator)) + if not isinstance(value, (float, int)): + raise UserError(_("Invalid domain right operand '%s'. It must be of type Integer/Float", value)) + product_ids = set() domain_quant = self._get_domain_locations()[0] if lot_id: