[IMP] purchase: create purchase order without any purchase order lines.

On purchase orders, the scheduled date is mantadory. This date is computed from
the purchase order lines and hidden. If there is no purchase order line, the date
stays empty and it's not possible to save the PO.
This commit uses the order date as scheduled date if there are no PO lines
This commit is contained in:
Darshil Trivedi
2018-05-18 08:28:11 +02:00
committed by William Henrotin
parent 47c34d2932
commit 142e8fca2e
+3 -1
View File
@@ -32,7 +32,7 @@ class PurchaseOrder(models.Model):
'amount_total': amount_untaxed + amount_tax,
})
@api.depends('order_line.date_planned')
@api.depends('order_line.date_planned', 'date_order')
def _compute_date_planned(self):
for order in self:
min_date = False
@@ -41,6 +41,8 @@ class PurchaseOrder(models.Model):
min_date = line.date_planned
if min_date:
order.date_planned = min_date
else:
order.date_planned = order.date_order
@api.depends('state', 'order_line.qty_invoiced', 'order_line.qty_received', 'order_line.product_qty')
def _get_invoiced(self):