[FIX] stock: return empty recordset if no rule found

When _get_rule does not find any rule, it returns False. This
could create some tracebacks as we mostly expect a stock.rule.

It will give:
if False in <recordset>:
Hence a traceback:
TypeError: unsupported operand types in: False in stock.rule()

By applying these changes will resolve this issue.

Sentry-4206998573

closes odoo/odoo#123194

X-original-commit: d6a0b9810ffc7fad68ebf7b13902747d43024455
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
This commit is contained in:
althaf shaik
2023-06-06 10:30:03 +02:00
parent ce28cb2683
commit a3da3ec98a
+1 -1
View File
@@ -502,7 +502,7 @@ class ProcurementGroup(models.Model):
""" Find a pull rule for the location_id, fallback on the parent
locations if it could not be found.
"""
result = False
result = self.env['stock.rule']
location = location_id
while (not result) and location:
domain = self._get_rule_domain(location, values)