[IMP]stock: Improve the test cases and statements of test

bzr revid: dbr@tinyerp.com-20111128104359-k90im8ibg9ujt3jk
This commit is contained in:
DBR (OpenERP) 2011-11-28 16:13:59 +05:30
parent 9b921998af
commit dd7a468a16
3 changed files with 49 additions and 23 deletions

View File

@ -7,7 +7,7 @@
location_dest_id: stock.stock_location_customers
location_id: stock.stock_location_stock
-
Now, withe help of 'Scrap Move' wizard, I scap the move of same Quantity.
Now, with the help of 'Scrap Move' wizard, I scap the move of same Quantity.
-
!python {model: stock.move.scrap}: |
context = {'active_model':'stock.move', 'active_id': ref('stock_move_4'), 'active_ids': [ref('stock_move_4')]}

View File

@ -1,13 +1,15 @@
-
In order to test partial delivery and back orders, I will use a delivery order with 5 CPU1 and 5 CPU3
-
I confirm and force the availability of all products on the picking OUT001
-
In order to test partial delivery and back orders,
I select a delivery order of CPU1 and CPU3 product each contain five quantities.
-
I confirm the picking 'OUT001' and make it available .
-
!python {model: stock.picking}: |
self.draft_force_assign(cr, uid, [ref('stock.stock_picking_1')], {})
self.force_assign(cr, uid, [ref('stock.stock_picking_1')], {})
-
After having confirmed the picking and its two lines, I add a new move line in draft state with 7 FAN2
After confirmed the picking and its two lines,
I add a new move line in draft state with 'FAN2' of seven quantities.
-
!record {model: stock.move, id: stock_move_3}:
product_id: product.product_product_fan2
@ -17,7 +19,7 @@
picking_id: stock_picking_1
- |
I click on 'Process Now' to process the delivery order and I change quantities to:
7 CPU1, 0 CPU3, 3 FAN2 and a new product of 4 PC1
seven for CPU1, zero for CPU3, three for FAN2 and a new product PC1 for four quantites for test the partial delivery.
-
!python {model: stock.picking}: |
result = self.action_process(cr, uid, [ref('stock.stock_picking_1')], {})['res_id']
@ -46,7 +48,7 @@
}, {})
self.pool.get('stock.partial.picking').do_partial(cr, uid, [result], {})
-
I test that the back order contains 5 CPU3, 4 FAN2 and nothing else
I test that the back order contains five CPU3 and four FAN2.
-
!python {model: stock.picking}: |
pick = self.browse(cr, uid, ref('stock.stock_picking_1'), {})
@ -59,4 +61,19 @@
assert line.product_qty == 0.0, "Wrong quantity for PC1 back order"
else:
assert line.product_qty == 0.0, "Wrong quantity for %s back order" % (line.product_id.code,)
-
After the partial picking I check the delivery order or backorder and stock moves.
-
!python {model: stock.picking}: |
result = self.search(cr, uid, [('name','=','OUT/00001')])
pick = self.pool.get('stock.picking').browse(cr, uid, result)
stock = self.pool.get('stock.move')
assert pick[0].state == 'assigned',"After partial picking the remaining product's delivery order must be in 'Ready to process' state"
assert pick[0].backorder_id.state == 'done',"The backorder state should be 'Done'"
done_move = stock.search(cr, uid, [('picking_id','=',pick[0].backorder_id.id)])
assign_move = stock.search(cr, uid, [('picking_id','=',pick[0].id)])
for move in stock.browse(cr, uid, done_move):
assert move.state == 'done',"Stock move of %s picking should be in 'Done' state"%(move.picking_id)
for move in stock.browse(cr, uid, assign_move):
assert move.state == 'assigned' or 'draft',"Stock move of %s picking should be in 'Available' state"%(move.picking_id)

View File

@ -1,33 +1,32 @@
-
In order to test the stock module, I will update the current stock of the product.
-
-
I assignd the created location in to warehouse.
-
-
!record {model: stock.warehouse, id: stock.warehouse0}:
lot_stock_id: stock_location_stock
-
I create Stock Production Lot for product CPU2
I create stock production lot for product CPU2
-
!record {model: stock.production.lot, id: stock_production_lot0}:
product_id: product.product_product_cpu2
date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
name: 0000001
-
I trace the Stock Production Lot for product CPU2
-
!python {model: stock.production.lot }: |
self.action_traceability(cr,uid,[ref('stock_production_lot0')], {'lang': 'en_US', 'tz': False, 'active_model': 'ir.ui.menu', 'field': '', 'type': ''})
-
I take one product CPU2 and with the help of 'Change Product Quantity' wizard I update the product stock.
Changes the Product Quantity by making a Physical Inventory.
-
!python {model: stock.change.product.qty}: |
#stock.stock_location_stock
product = self.pool.get('product.product').browse(cr, uid, ref('product.product_product_cpu2'))
fields = {'location_id' : ref('stock_location_stock'), 'new_quantity': 2, 'product_id': product.id, 'prodlot_id': ref('stock.stock_production_lot0')}
ids = self.create(cr, uid, fields)
self.change_product_qty(cr, uid, [ids], {'active_model':'product.product', 'active_id': product.id, 'active_ids':[product.id]})
assert product.qty_available == 2,'Product Quantity is not Updated'
-
I trace the Stock Production Lot for product CPU2
-
!python {model: stock.production.lot }: |
self.action_traceability(cr,uid,[ref('stock_production_lot0')], {'lang': 'en_US', 'tz': False, 'active_model': 'ir.ui.menu', 'field': '', 'type': ''})
-
I check Physical Inventory created.
-
@ -44,15 +43,21 @@
!python {model: stock.move}: |
ids = self.search(cr, uid, [('product_id','=',ref('product.product_product_cpu2'))])
assert [x.state for x in self.browse(cr, uid, ids) if x.state == 'done'], 'stock moves should be done!'
-
Now for the test chain location functionality,
-
For the test chain location functionality,
I create stock production lot for product 'Sprouting Foods'.
-
!record {model: stock.production.lot, id: stock_production_lot2}:
product_id: product.product_product_sprouting
date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
name: 0000002
-
I update product 'Sprouting Foods' with the help of 'Change Product Quantity' wizard
and assign a location 'Refrigerated Vehicles' to test the chained location flow.
-
-
!python {model: stock.change.product.qty}: |
product = self.pool.get('product.product').browse(cr, uid, ref('product.product_product_sprouting'))
fields = {'location_id' : ref('refrigerate_location_stock'), 'new_quantity': 1, 'product_id': product.id}
fields = {'location_id' : ref('refrigerate_location_stock'), 'new_quantity': 1, 'product_id': product.id, 'prodlot_id': ref('stock.stock_production_lot2')}
ids = self.create(cr, uid, fields)
self.change_product_qty(cr, uid, [ids], {'active_model':'product.product', 'active_id': product.id, 'active_ids':[product.id]})
@ -69,4 +74,8 @@
assert i.location_dest_id.name == 'Cold Storage',"Destination location must be 'Cold Storage' because the source location is 'Refrigerated Vehicles'"
if i.location_id.name == 'Cold Storage':
assert i.location_dest_id.name == 'Customers',"Destination location must be 'Customers' because the source location is 'Cold Storage'"
-
I trace the stock production lot for product 'Sprouting Foods'
-
!python {model: stock.production.lot }: |
self.action_traceability(cr,uid,[ref('stock_production_lot2')], {'active_model': 'ir.ui.menu', 'field': '', 'type': ''})