[FIX] purchase: date planned

When a PO is copied, the date planned of the order lines should be
recomputed based on the order date.

opw-675480
This commit is contained in:
Nicolas Martinelli
2016-05-12 09:48:19 +02:00
parent 1876279f2f
commit 49ea75973d
+10
View File
@@ -186,6 +186,16 @@ class PurchaseOrder(models.Model):
raise UserError(_('In order to delete a purchase order, you must cancel it first.'))
return super(PurchaseOrder, self).unlink()
@api.multi
def copy(self, default=None):
new_po = super(PurchaseOrder, self).copy()
for line in new_po.order_line:
seller = line.product_id._select_seller(
line.product_id, partner_id=line.partner_id, quantity=line.product_qty,
date=line.order_id.date_order and line.order_id.date_order[:10], uom_id=line.product_uom)
line.date_planned = line._get_date_planned(seller)
return new_po
@api.multi
def _track_subtype(self, init_values):
self.ensure_one()