From 4fe7137a14a28aa2d9ad80ee2ac30e3700195636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 21 Apr 2017 10:17:56 +0200 Subject: [PATCH] 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 --- sale.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sale.py b/sale.py index 549696ec5a..c74cffce2a 100644 --- a/sale.py +++ b/sale.py @@ -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