odoo/odoo#189621

Created by fw-bot
Merged at 23e1c6b4ea065fc8eefca91db1e73480045a032b

Statuses:

label
odoo-dev:master-17.0-stock-get-rule-indexerror-avd-Uid--fw
head
e08b228df2ab43f6135cfac69a2c1178a9de969e
merged
9 months ago by Logistics, William Henrotin (whe)
odoo/odoo
17.0 #188953
saas-17.2 #189547
saas-17.4 #189563
18.0 #189593
saas-18.2
saas-18.3
saas-18.4
master #189621

[FW][FIX] stock: prevent IndexError in _get_rule

When location_id is None in _get_rule the line while locations[-1].location_id raises an IndexError. This commit fixes that by returning early with an empty recordset of stock.rule in case location_id is None.


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #188953