d68c12c6366103d62914083f858cba6faf9577ab
[odoo/odoo.git] / addons / purchase_requisition / test / process / purchase_requisition_exclusive.yml
1 -
2   In order to test the exclusive type requisition, I have to create two differ purchase order in one requisition [Tender]
3 -
4   I start by Checking the product, Product must have requisition field checked. 
5 -
6   !record {model: product.product, id: product.product_product_cpu1}:
7     purchase_requisition: True
8 -
9   Checking requisition field for another product. 
10 -
11   !record {model: product.product, id: product.product_product_cpu3}:
12     purchase_requisition: True
13 -
14   Now check that purchase order's product must have requisition field checked.
15 -
16   !python {model: purchase.order}: |
17     import netsvc
18     wf_service = netsvc.LocalService("workflow")
19     pur_order = self.pool.get('purchase.order')
20     ids = pur_order.search(cr, uid, [('requisition_id','=',ref('order_purchase_requisition1'))])
21     po_id = pur_order.browse(cr, uid, ids)
22     for po in po_id:
23       for line in po.order_line:
24         if line.product_id.purchase_requisition == False:
25           assert line.product_id.purchase_requisition == True, "Purchase Order's product must have requisition field checked"
26     po_confirm = po_id[0].id
27     wf_service.trg_validate(uid, 'purchase.order',po_confirm,'purchase_confirm', cr)
28     assert po_id[0].state == 'approved',"After confirm a purchase order it should be in confirm state"
29     assert po_id[1].state == 'cancel',"After confirmed a purchase order form the this requisition the second purchase order should be automatically goes in to cancelled state"
30
31
32
33
34