Test if get_supply_dates is defined on PurchaseRequest

The method is defined in stock_supply but the model in purchase_request, so we
can have the model without the method.

issue6445
review41261002
This commit is contained in:
Cédric Krier
2017-04-21 10:17:56 +02:00
parent 3e64617fdc
commit 4fe7137a14
+2 -1
View File
@@ -57,7 +57,8 @@ class Sale:
except KeyError:
PurchaseRequest = None
if PurchaseRequest and product.purchasable:
if (getattr(PurchaseRequest, 'get_supply_dates', None)
and product.purchasable):
return PurchaseRequest.get_supply_dates(product)[0]
else:
# TODO compute supply date for production