[FIX] purchase: don't raise if standard route is deleted
New api regression: xmlid_to_res_id() had the flag to raise set to false by default while ref() does the opposite. Since the intent here was clearly to allow not finding the record (given the if condition under the ref call), avoid crashing for a simple default.
This commit is contained in:
@@ -983,7 +983,7 @@ class ProductTemplate(models.Model):
|
||||
|
||||
@api.model
|
||||
def _get_buy_route(self):
|
||||
buy_route = self.env.ref('purchase.route_warehouse0_buy')
|
||||
buy_route = self.env.ref('purchase.route_warehouse0_buy', raise_if_not_found=False)
|
||||
if buy_route:
|
||||
return buy_route.ids
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user