From a3da3ec98a2ac2e6597aeff127cf9c9dd3fc9e80 Mon Sep 17 00:00:00 2001 From: althaf shaik Date: Fri, 26 May 2023 10:23:40 +0000 Subject: [PATCH] [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 : 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) --- addons/stock/models/stock_rule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_rule.py b/addons/stock/models/stock_rule.py index e33c63afd92..e62d501c5fc 100644 --- a/addons/stock/models/stock_rule.py +++ b/addons/stock/models/stock_rule.py @@ -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)