-
  I create the procurement order and run that procurement.
-
  !python {model: make.procurement}: |
    context.update({'active_model':'product.product', 'active_ids': [ref('product.product_product_13')], 'active_id': ref('product.product_product_13')})
-
  !record {model: make.procurement, id: procurement_product_hdd3}:
    product_id: product.product_product_13
    qty: 15
    uom_id: product.product_uom_unit
    warehouse_id: stock.stock_warehouse_shop0
-
  !python {model: make.procurement}: |
    self.make_procurement(cr, uid, [ref('procurement_product_hdd3')], context)
-
  I run the scheduler.
-
  !python {model: procurement.order}: |
    self.run_scheduler(cr, uid)
-
  I check requisition details which created after run procurement.
-
  !python {model: procurement.order}: |
    procurement_ids = self.search(cr, uid, [('requisition_id','!=', False)])
    for procurement in self.browse(cr, uid, procurement_ids, context=context):
        requisition = procurement.requisition_id
        assert requisition.date_end == procurement.date_planned, "End date is not correspond."
        assert len(requisition.line_ids) == 1, "Requisition Lines should be one."
        line = requisition.line_ids[0]
        assert line.product_id.id == procurement.product_id.id, "Product is not correspond."
        assert line.product_uom_id.id == procurement.product_uom.id, "UOM is not correspond."
        assert line.product_qty == procurement.product_qty, "Quantity is not correspond."
-
  I open another requisition.
-
  !python {model: purchase.requisition}: |
    self.tender_in_progress(cr, uid, [ref("requisition1")], context=context)
- 
  Supplier send one RFQ so I create requisition request of that supplier.
-
  !python {model: purchase.requisition.partner}: |
    context.update({"active_model": "purchase.requisition","active_ids": [ref("requisition1")],"active_id": ref("requisition1")})
- 
  !record {model: purchase.requisition.partner, id: requisition_partner_0}:
    partner_id: base.res_partner_12
- 
  !python {model: purchase.requisition.partner}: |
    self.create_order(cr, uid, [ref("requisition_partner_0")], context=context)
-
  I check that the RFQ details which created for supplier.
-
  !python {model: purchase.order}: |
    purchase_requisition = self.pool.get("purchase.requisition")
    purchase_ids = self.search(cr, uid, [('requisition_id','=',ref("requisition1"))])
    assert purchase_ids, "RFQ is not created."
    rfq = self.browse(cr, uid, purchase_ids[0], context=context)
    requisition = rfq.requisition_id
    supplier = rfq.partner_id
    assert supplier.id == ref('base.res_partner_12'), "RFQ Partner is not correspond."
    assert len(rfq.order_line) == len(requisition.line_ids), "Lines are not correspond."
    for rfq_line in rfq.order_line:
        for line in requisition.line_ids:
            if rfq_line.product_id.id == line.product_id.id:
                seller_price, qty, default_uom_po_id, date_planned = purchase_requisition._seller_details(cr, uid, line, supplier, context=context)
                assert rfq_line.product_qty == qty, "Quantity is not correspond."
                assert rfq_line.product_uom.id == default_uom_po_id, "UOM is not correspond."
                assert rfq_line.price_unit == seller_price, "Unit Price is not correspond."   
-
  I confirmed RFQ which has best price.
-
  !python {model: purchase.order}: |
    import netsvc
    wf_service = netsvc.LocalService("workflow")
    purchase = self.browse(cr, uid, ref('rfq2'), context=context)
    wf_service.trg_validate(uid, 'purchase.order', purchase.id, 'purchase_confirm', cr)

-
  I check status of requisition after confirmed best RFQ.
-
  !python {model: purchase.requisition}: |
    requisition = self.browse(cr, uid, ref('requisition1'), context=context)
    requisition.state == 'done', "Requisition should be closed."
-
  I print a Requisition report
- 
  !python {model: purchase.requisition}: |
    import netsvc, tools, os
    (data, format) = netsvc.LocalService('report.purchase.requisition').create(cr, uid, [ref('purchase_requisition.requisition1')], {}, {})
    if tools.config['test_report_directory']:
        file(os.path.join(tools.config['test_report_directory'], 'purchase_requisition-purchase_requisition_report.'+format), 'wb+').write(data)
