From 98d8210042a70bfaef7c8300c6feb07fd3a10665 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Wed, 26 Aug 2015 12:40:29 +0200 Subject: [PATCH] [FIX] New res_partner in orderpoint_calendar.yml instead of res_patner_2 The res_partner squash has added several information to the res_partner_2 Now the is a purchase order for which he's the supplier. In that case, the planned date on the purchase order line is influenced by the planned date of the other purchase orders where this partner is the supplier. Here we create a new res_partner for this test who has no purchase orders related In that case, the planned date will always the date planned in the calendar at the basis, which is 3. --- .../stock_calendar/test/orderpoint_calendar.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/addons/stock_calendar/test/orderpoint_calendar.yml b/addons/stock_calendar/test/orderpoint_calendar.yml index c95b5ca7222..23e358b79eb 100644 --- a/addons/stock_calendar/test/orderpoint_calendar.yml +++ b/addons/stock_calendar/test/orderpoint_calendar.yml @@ -1,3 +1,9 @@ +- + Create a partner +- + !record {model: res.partner, id: res_partner_cal}: + name: Supplier + supplier: 1 - Create a calendar - @@ -14,7 +20,7 @@ !record {model: product.product, id: product_calendar}: name: Calendar Product seller_ids: - - name: base.res_partner_2 + - name: res_partner_cal delay: 1 orderpoint_ids: - name: Product A Truck @@ -27,7 +33,7 @@ - !record {model: stock.picking, id: pick_out_calendar}: name: Delivery order for procurement - partner_id: base.res_partner_2 + partner_id: res_partner_cal picking_type_id: stock.picking_type_out move_lines: - product_id: product_calendar @@ -40,7 +46,7 @@ - !record {model: stock.picking, id: pick_out_calendar2}: name: Delivery order for procurement - partner_id: base.res_partner_2 + partner_id: res_partner_cal picking_type_id: stock.picking_type_out move_lines: - product_id: product_calendar @@ -53,7 +59,7 @@ - !record {model: stock.picking, id: pick_out_calendar3}: name: Delivery order for procurement - partner_id: base.res_partner_2 + partner_id: res_partner_cal picking_type_id: stock.picking_type_out move_lines: - product_id: product_calendar @@ -88,5 +94,6 @@ procurement = proc_obj.browse(cr, uid, proc_ids[0]) assert procurement.product_qty == 17, 'It should have taken the two first pickings into account for the virtual stock for the orderpoint, not the third' assert datetime.datetime.strptime(procurement.next_delivery_date, DEFAULT_SERVER_DATETIME_FORMAT).weekday() == 3, 'The next delivery date should be on a Thursday' - assert datetime.datetime.strptime(procurement.purchase_line_id.date_planned, DEFAULT_SERVER_DATETIME_FORMAT).weekday() == 4, 'Check it has been put on the purchase line also' + purchase_line_id_date_planned = datetime.datetime.strptime(procurement.purchase_line_id.date_planned, DEFAULT_SERVER_DATETIME_FORMAT).weekday() + assert purchase_line_id_date_planned == 3, 'Check it has been put on the purchase line also, got %d' %purchase_line_id_date_planned