[FIX] purchase: unable to add notes/section PO Line

In compute method _compute_expected_date() all PO lines
are processed to get expected date, but in note and section
line we dont have date_planned, it generates error. filtered
the PO line to process if only they are not having display_type.

Fixes-2234053

closes odoo/odoo#49433

X-original-commit: 2163c6a05476ddfbf899e46eac565b7f5cc5f46e
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
Pratima Gupta
2020-04-10 15:41:14 +00:00
parent 43a2f2051b
commit d7a336b4dd
+1 -1
View File
@@ -163,7 +163,7 @@ class PurchaseOrder(models.Model):
def _compute_expected_date(self):
""" expected_date = the earliest date_planned across all order lines. """
for order in self:
dates_list = order.order_line.mapped('date_planned')
dates_list = order.order_line.filtered(lambda x: not x.display_type).mapped('date_planned')
order.expected_date = fields.Datetime.to_string(min(dates_list)) if dates_list else False
@api.depends('name', 'partner_ref')