[IMP]puchase_requisition:Improve the test case for
create procurement order from product bzr revid: dbr@tinyerp.com-20111031084858-e26x17iufxwbzrtu
This commit is contained in:
@@ -9,21 +9,25 @@
|
||||
supply_method: 'buy'
|
||||
purchase_requisition: True
|
||||
-
|
||||
I create the procurement order.
|
||||
I create the procurement order for the product.
|
||||
-
|
||||
!python {model: make.procurement}: |
|
||||
!python {model: product.product}: |
|
||||
import time
|
||||
product = self.pool.get('product.product').browse(cr, uid,[ref('product.product_product_hdd3')])
|
||||
#product_uom = product.product_uom
|
||||
fields = {
|
||||
'qty': 5.0,
|
||||
'product_id': product,
|
||||
#'uom_id': product_uom,
|
||||
#'warehouse_id': stock.warehouse0,
|
||||
'date_planned': time.strftime('%Y-%m-%d')
|
||||
}
|
||||
a = self.default_get(cr, uid, fields, context)
|
||||
req_id = self.make_procurement(cr, uid, [ref('product.product_product_hdd3')], context)
|
||||
procurement = self.pool.get('make.procurement')
|
||||
product = self.browse(cr, uid,[ref('product.product_product_hdd3')])
|
||||
context = {'active_model': 'product.product','active_ids': [product[0].id],'active_id': product[0].id}
|
||||
default_data = procurement.default_get(cr, uid, ['uom_id', 'warehouse_id', 'date_planned', 'product_id', 'qty'], context)
|
||||
vals = {'uom_id': product[0].uom_id.id,'warehouse_id': ref('stock.stock_warehouse_shop0'),'qty': default_data.get('qty'),'date_planned': default_data.get('date_planned')}
|
||||
ids = procurement.create(cr, uid, vals, context)
|
||||
req_id = procurement.make_procurement(cr, uid, [ids], context)
|
||||
proc_order = self.pool.get('procurement.order')
|
||||
order = proc_order.browse(cr, uid, [req_id.get('res_id')])
|
||||
assert order[0].state == "confirmed", "Procurement Order should be in Confirmed state"
|
||||
assert order[0].product_id == product[0],"Product is not correspond in procurement order"
|
||||
assert order[0].product_qty == default_data.get('qty'),"Product's quantity is not correspond in procurement order"
|
||||
assert order[0].product_uom == product[0].uom_id,"Product's UOM is not correspond in procurement order"
|
||||
|
||||
|
||||
-
|
||||
I create the procurement order from the selected purchase order.
|
||||
-
|
||||
|
||||
Reference in New Issue
Block a user