purchase_order_product_recommendation_supermarket: fix error when last order from vendor is not received yet
This commit is contained in:
parent
e72fa0d59d
commit
ea68e3cc30
1 changed files with 6 additions and 2 deletions
|
|
@ -70,8 +70,12 @@ class PurchaseOrderRecommendationSupermarketWizard(models.TransientModel):
|
||||||
],
|
],
|
||||||
order="date_order asc",
|
order="date_order asc",
|
||||||
)
|
)
|
||||||
|
if orders:
|
||||||
self.date_last_order = orders[-1].effective_date.date() if orders else False
|
self.date_last_order = (
|
||||||
|
orders[-1].effective_date.date()
|
||||||
|
if orders[-1].effective_date
|
||||||
|
else orders[-1].date_planned.date()
|
||||||
|
)
|
||||||
|
|
||||||
dates = [o.date_order.date() for o in orders if o.date_order]
|
dates = [o.date_order.date() for o in orders if o.date_order]
|
||||||
if len(dates) < 2:
|
if len(dates) < 2:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue