From 2d0ff8afa4a6c7e79500459cd3260920cb47809f Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Tue, 13 Dec 2016 17:07:38 +0100 Subject: [PATCH] [FIX] purchase: set all dates and not-stored field (9.0 only) The feature "set all date to all order line" on a purchase order allow user to update the schedulded date of all order lines. It was backported in 9.0 with 401a3cfa but in 9.0 date_planned was not stored, the button would wrongly set the scheduled dates of the lines to the minimum date. With this commit the functionality should work as expected, unless someone use an out-of-date template in which case the functionnality is disabled. opw-697680 note: PO date_planned is stored after 9.0 so this commit must not be forward-ported. --- addons/purchase/purchase.py | 7 +++++-- addons/purchase/purchase_view.xml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 5acfab70974..360043ab1a4 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -441,10 +441,13 @@ class PurchaseOrder(models.Model): @api.multi def action_set_date_planned(self): + # implementation for 9.0 where PO date_planned is not stored + date_planned = self.env.context.get('date_planned') + if not date_planned: + return for order in self: - #DO NOT FORWARD PORT for line in order.order_line: - line.update({'date_planned': order.date_planned}) + line.update({'date_planned': date_planned}) class PurchaseOrderLine(models.Model): diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 020c753d479..b51515880e2 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -252,7 +252,7 @@