From c1eb9abf86ab548491eb27c4659e560baa0378b7 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Thu, 13 May 2010 12:18:32 +0530 Subject: [PATCH] [IMP]: Improve the yml for purchase_requisition and delivery bzr revid: sbh@tinyerp.com-20100513064832-rbv0erf9aujoj42n --- addons/delivery/test/delivery_test.yml | 6 +++--- .../test/purchase_requisition.yml | 11 +++++++---- .../test/purchase_requisition_exclusive.yml | 10 +++++++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/addons/delivery/test/delivery_test.yml b/addons/delivery/test/delivery_test.yml index 3597ca523fa..36bc6ec7e19 100644 --- a/addons/delivery/test/delivery_test.yml +++ b/addons/delivery/test/delivery_test.yml @@ -1,5 +1,5 @@ - - In order to test the delivery module, I will do Configuration ‣ Delivery ‣ Delivery Method + In order to test the delivery module, I will do Configuration -> Delivery -> Delivery Method And there are two methods for doing that Delivery based on order quantities, Delivery based on delivered quantities. @@ -37,14 +37,14 @@ - - Creating a Delivery Method + I create the Delivery Method - !record {model: delivery.carrier, id: delivery_carrier_theopenerpexperss0}: name: The OpenERP Experss partner_id: res_partner_thepost0 product_id: product_product_deliverybypost0 - - Creating a delivery.grid record and define the region for which the tariffs in the grid will be applicable. + I Create a delivery grid record and define the region for which the tariffs in the grid will be applicable. Then set the condition for which this rule is applicable - !record {model: delivery.grid, id: delivery_grid_weight0}: diff --git a/addons/purchase_requisition/test/purchase_requisition.yml b/addons/purchase_requisition/test/purchase_requisition.yml index ef2331a3518..6a8d52ed201 100644 --- a/addons/purchase_requisition/test/purchase_requisition.yml +++ b/addons/purchase_requisition/test/purchase_requisition.yml @@ -1,6 +1,6 @@ - - In order to test the purchase requicisition module, I will do a sale order -> purchase_requisition -> + In order to test the purchase requisition module, I will do a sale order -> purchase_requisition -> purchase flow and I will buy the required products at two different suppliers. - I start by creating a new product 'Laptop ACER', which is purchased at Asustek, in MTO, @@ -109,10 +109,12 @@ !python {model: purchase.order}: | line_obj=self.pool.get('purchase.order.line') partner_obj=self.pool.get('res.partner') + requistion_obj=self.pool.get('purchase.requisition') + requistion_ids =requistion_obj.search(cr, uid, [('origin','=','TEST/TENDER/0001')]) partner_id1=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0] - partner_id2=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] - purchase_id1= self.search(cr, uid, [('partner_id','=',partner_id1)]) - purchase_id2= self.search(cr, uid, [('partner_id','=',partner_id2)]) + partner_id2=partner_obj.search(cr,uid,[('name','=','Distrib PC')])[0] + purchase_id1= self.search(cr, uid, [('partner_id','=',partner_id1),('requisition_id','in',requistion_ids)]) + purchase_id2= self.search(cr, uid, [('partner_id','=',partner_id2),('requisition_id','in',requistion_ids)]) order_line1=self.browse(cr, uid, purchase_id1, context)[0].order_line[0].id order_line2=self.browse(cr, uid, purchase_id2, context)[0].order_line[0].id line_obj.write(cr, uid, order_line1, {'product_qty':2}) @@ -147,6 +149,7 @@ !python {model: stock.picking }: | import time partner_obj=self.pool.get('res.partner') + order_obj=self.pool.get('purchase.order') partner_id=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0] picking_id = self.search(cr, uid, [('address_id.partner_id','=',partner_id),('type','=','in')]) if picking_id: diff --git a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml index cc59649577e..030b80b2260 100644 --- a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml +++ b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml @@ -1,5 +1,5 @@ - - In order to test the purchase requicisition module, I will do a sale order -> purchase_requisition -> + In order to test the purchase requisition module, I will do a sale order -> purchase_requisition -> purchase flow and I will buy the required products at two different suppliers. - @@ -99,7 +99,9 @@ - !python {model: purchase.order}: | partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','ASUStek')])[0] - purchase_id= self.search(cr, uid, [('partner_id','=',partner_id)])[0] + req_obj = self.pool.get('purchase.requisition') + ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0002')]) + purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)])[0] import netsvc wf_service = netsvc.LocalService("workflow") if purchase_id: @@ -110,6 +112,8 @@ - !python {model: purchase.order}: | partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] - purchase_id= self.search(cr, uid, [('partner_id','=',partner_id)])[0] + req_obj = self.pool.get('purchase.requisition') + ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0002')]) + purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)])[0] state=self.browse(cr,uid,purchase_id).state assert (state=='cancel') \ No newline at end of file