[IMP]stock: Improve the YML test cases
bzr revid: dbr@tinyerp.com-20111207094016-je57fcseuplkqs54
This commit is contained in:
parent
57afcbbfd9
commit
fee67a8aba
|
@ -90,14 +90,7 @@
|
|||
<field name="usage">view</field>
|
||||
<field name="location_id" ref="stock_location_locations"/>
|
||||
</record>
|
||||
<record id="cold_location_1" model="stock.location">
|
||||
<field name="name">Cold Storage</field>
|
||||
<field name="location_id" ref="stock_location_suppliers"/>
|
||||
<field name="chained_location_type">fixed</field>
|
||||
<field name="chained_location_id" ref="stock_location_customers"/>
|
||||
<field name="chained_auto_packing">auto</field>
|
||||
<field name="usage">internal</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="journal_delivery" model="stock.journal">
|
||||
<field name="name">Delivery Orders</field>
|
||||
|
@ -112,15 +105,6 @@
|
|||
<field name="chained_journal_id" ref="journal_delivery"/>
|
||||
</record>
|
||||
|
||||
<record id="refrigerate_location_stock" model="stock.location">
|
||||
<field name="name">Refrigerated Vehicles</field>
|
||||
<field name="location_id" ref="stock_location_company"/>
|
||||
<field name="chained_auto_packing">auto</field>
|
||||
<field name="chained_location_type">fixed</field>
|
||||
<field name="usage">internal</field>
|
||||
<field name="chained_location_id" ref="cold_location_1"/>
|
||||
</record>
|
||||
|
||||
<record id="stock_location_stock" model="stock.location">
|
||||
<field name="name">Stock</field>
|
||||
<field name="location_id" ref="stock_location_company"/>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<!--
|
||||
Resource: stock.location
|
||||
-->
|
||||
<record id="chain_location_1" model="stock.location">
|
||||
<record id="cold_location_1" model="stock.location">
|
||||
<field name="name">Cold Storage</field>
|
||||
<field name="location_id" ref="stock_location_suppliers"/>
|
||||
<field name="chained_location_type">fixed</field>
|
||||
|
@ -50,6 +50,14 @@
|
|||
<field name="name">Shelf 1</field>
|
||||
<field name="location_id" ref="stock_location_stock"/>
|
||||
</record>
|
||||
<record id="refrigerate_location_stock" model="stock.location">
|
||||
<field name="name">Refrigerated Vehicles</field>
|
||||
<field name="location_id" ref="stock_location_company"/>
|
||||
<field name="chained_auto_packing">auto</field>
|
||||
<field name="chained_location_type">fixed</field>
|
||||
<field name="usage">internal</field>
|
||||
<field name="chained_location_id" ref="cold_location_1"/>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Resource: stock.inventory
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
-
|
||||
Create a picking
|
||||
-
|
||||
!record {model: stock.picking, id: stock_picking_1}:
|
||||
type: out
|
||||
company_id: base.main_company
|
||||
address_id: res_partner_address_fabien0
|
||||
-
|
||||
Create a move
|
||||
-
|
||||
!record {model: stock.move, id: stock_move_1}:
|
||||
product_id: product.product_product_cpu1
|
||||
|
@ -17,8 +13,6 @@
|
|||
location_id: stock.stock_location_stock
|
||||
name: CPU1, Processor AMD Athlon XP 1800
|
||||
picking_id: stock_picking_1
|
||||
-
|
||||
Create another move
|
||||
-
|
||||
!record {model: stock.move, id: stock_move_2}:
|
||||
product_id: product.product_product_cpu3
|
||||
|
@ -29,8 +23,6 @@
|
|||
location_id: stock.stock_location_stock
|
||||
name: CPU3, Processor AMD Athlon XP 1800
|
||||
picking_id: stock_picking_1
|
||||
-
|
||||
Create one more move
|
||||
-
|
||||
!record {model: stock.move, id: stock_move_3}:
|
||||
product_id: product.product_product_pc1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-
|
||||
In order to test the cancel stock. I start from cancelling the incoming shipment.
|
||||
In order to test the cancel stock. I start from cancelling the Delivery order.
|
||||
-
|
||||
First, I create copies of incoming shipment.
|
||||
First, I create copies of Delivery order.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
stock = self.pool.get('stock.move')
|
||||
|
@ -11,7 +11,7 @@
|
|||
id3 = self.copy(cr, uid, ref('stock.stock_picking_1'), context)
|
||||
context.update({'id1':id1,'id2':id2,'id3':id3})
|
||||
-
|
||||
Now, I cancel all related moves of picking so automatically picking goes to cancelled state..
|
||||
Now, I cancel all related stock moves of Delivery order so automatically Delivery order goes to cancelled state.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
import netsvc
|
||||
|
@ -24,7 +24,7 @@
|
|||
stock.force_assign(cr, uid, move)
|
||||
wf_service.trg_validate(uid, 'stock.move', move, 'action_cancel', cr)
|
||||
-
|
||||
Now, directlly cancel the picking.
|
||||
Now, directlly cancel the Delivery order.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
import netsvc
|
||||
|
@ -32,7 +32,7 @@
|
|||
pick_id = context.get('id2')
|
||||
wf_service.trg_validate(uid, 'stock.picking', pick_id, 'button_cancel', cr)
|
||||
-
|
||||
I return the picking.
|
||||
I return the Delivery order.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
copy_id = context.get('id3')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-
|
||||
In order to test the delete stock, create a copy of picking.
|
||||
In order to test the delete stock, create a copy of Delivery order.
|
||||
-
|
||||
First, I create copy of picking.
|
||||
First, I create copy of Delivery order.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
context.update({'active_id':ref('stock.stock_picking_1')})
|
||||
|
@ -12,13 +12,13 @@
|
|||
move_id = stock.copy(cr, uid, move_ids[0],context)
|
||||
context.update({'id1':id1,'move':move_id})
|
||||
-
|
||||
Now, I delete a related moves of picking.
|
||||
Now, I delete a related moves of Delivery order.
|
||||
-
|
||||
!python {model: stock.move}: |
|
||||
move = context.get('move')
|
||||
self.unlink(cr, uid, [move])
|
||||
-
|
||||
Now, directlly delete the picking.
|
||||
Now, directlly delete the Delivery order.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
id = context.get('id1')
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
-
|
||||
In order to test the chain location functionality,
|
||||
I create stock production lot for product 'Sprouting Foods'.
|
||||
In order to test chained locations, I update the stock of product.
|
||||
-
|
||||
I create stock production lot for product.
|
||||
-
|
||||
!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.
|
||||
I update product quantity and check the stock moves are properly done or not
|
||||
-
|
||||
!python {model: stock.change.product.qty}: |
|
||||
product = self.pool.get('product.product').browse(cr, uid, ref('product.product_product_sprouting'))
|
||||
|
@ -16,7 +16,7 @@
|
|||
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]})
|
||||
-
|
||||
I check stock moves of product 'Sprouting Foods'.
|
||||
I check stock moves of product.
|
||||
-
|
||||
!python {model: stock.move}: |
|
||||
ids = self.search(cr, uid, [('product_id','=',ref('product.product_product_sprouting'))])
|
||||
|
@ -29,7 +29,7 @@
|
|||
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'.
|
||||
I trace the stock production lot for product.
|
||||
-
|
||||
!python {model: stock.production.lot }: |
|
||||
self.action_traceability(cr,uid,[ref('stock_production_lot2')], {'active_model': 'ir.ui.menu', 'field': '', 'type': ''})
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
-
|
||||
In order to test partial delivery and back orders,
|
||||
I select a delivery order of CPU1 and CPU3 product each contain five quantities.
|
||||
In order to test partial delivery and back orders, I select delivery order and check process on it.
|
||||
-
|
||||
I confirm the picking 'OUT001' and make it available .
|
||||
I confirm the Delivery order 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 confirmed the picking and its two lines,
|
||||
I add a new move line in draft state with 'FAN2' of seven quantities.
|
||||
I add a new move line in the delivery order.
|
||||
-
|
||||
!record {model: stock.move, id: stock_move_3}:
|
||||
product_id: product.product_product_fan2
|
||||
|
@ -18,8 +16,7 @@
|
|||
location_id: stock.stock_location_stock
|
||||
picking_id: stock_picking_1
|
||||
- |
|
||||
I click on 'Process Now' to process the delivery order and I change quantities to:
|
||||
seven for CPU1, zero for CPU3, three for FAN2 and a new product PC1 for four quantites for test the partial delivery.
|
||||
I make partial delivery for the delivery order.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
result = self.action_process(cr, uid, [ref('stock.stock_picking_1')], {})['res_id']
|
||||
|
@ -48,7 +45,7 @@
|
|||
}, {})
|
||||
self.pool.get('stock.partial.picking').do_partial(cr, uid, [result], {})
|
||||
-
|
||||
I test that the back order contains five CPU3 and four FAN2.
|
||||
I check the backorder and its moves.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
pick = self.browse(cr, uid, ref('stock.stock_picking_1'), {})
|
||||
|
@ -62,7 +59,7 @@
|
|||
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.
|
||||
After the partial picking of Delivery order I check the Backorder and stock moves.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
result = self.search(cr, uid, [('name','=','OUT/00001')])
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
!record {model: stock.move, id: stock_move_3}:
|
||||
tracking_id: stock_tracking_0
|
||||
-
|
||||
I split the picking in to two quantities.
|
||||
I split a Move of Delivery order in to two quantities.
|
||||
-
|
||||
!python {model: stock.move }: |
|
||||
move_ids=self.browse(cr,uid,ref('stock_move_3'))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-
|
||||
In order to test the stock module, I start it from physical inventory.
|
||||
In order to test the stock module, I need to create initial physical inventory.
|
||||
-
|
||||
I create a record for physical inventory and change the product quantity zero by making a physical inventory.
|
||||
I create a physical inventory and change the product quantity zero by making a physical inventory.
|
||||
-
|
||||
!record {model: stock.inventory, id: stock_physical_inventory0}:
|
||||
company_id: base.main_company
|
||||
|
@ -9,35 +9,38 @@
|
|||
name: Physical inventory
|
||||
state: draft
|
||||
-
|
||||
Now, Define the location for import inventory.
|
||||
-
|
||||
!record {model: stock.fill.inventory, id: stock_fill_inventory_0}:
|
||||
location_id: stock.stock_location_stock
|
||||
recursive: False
|
||||
set_stock_zero: True
|
||||
-
|
||||
I fill inventory.
|
||||
I define and fill the inventory. Create record using create method.
|
||||
-
|
||||
!python {model: stock.fill.inventory}: |
|
||||
context = {"full": "1", "active_model": "stock.inventory", "active_ids":[ref("stock_physical_inventory0")], "active_id": ref("stock_physical_inventory0")}
|
||||
vals = {
|
||||
'location_id': ref('stock_location_components'),
|
||||
'recursive': False,
|
||||
'set_stock_zero': True
|
||||
}
|
||||
ids = self.create(cr, uid, vals, context)
|
||||
context.update({"full": "1", "active_model": "stock.inventory","active_ids": [ids]})
|
||||
self.view_init(cr, uid, ["set_stock_zero", "location_id", "recursive"], context)
|
||||
try:
|
||||
self.fill_inventory(cr, uid, [ref("stock_fill_inventory_0")], context)
|
||||
except:
|
||||
pass
|
||||
inventory_id = context.get('ids')
|
||||
self.fill_inventory(cr, uid, inventory_id, context)
|
||||
-
|
||||
I confirm the inventory.
|
||||
-
|
||||
!python {model: stock.inventory}: |
|
||||
inventory = self.browse(cr, uid, [ref('stock_physical_inventory0')])
|
||||
inventory = self.browse(cr, uid, [ref('stock_physical_inventory0')])[0]
|
||||
self.action_confirm(cr,uid,[ref('stock_physical_inventory0')])
|
||||
assert inventory[0].state == 'confirm',"After confirm the inventory it should be in 'Confirm' state"
|
||||
for line in inventory[0].inventory_line_id:
|
||||
assert line.product_qty == 0.0,"Product Quantity should be Zero"
|
||||
assert inventory.state == 'confirm',"Inventory should be in 'Confirm' state"
|
||||
self.action_done(cr,uid,[ref('stock_physical_inventory0')])
|
||||
if inventory.inventory_line_id:
|
||||
for line in inventory.inventory_line_id:
|
||||
assert line.product_qty == 0.0,"Product Quantity should be Zero"
|
||||
assert len(inventory.move_ids) >= 1,"Move should be created after confirmed inventory"
|
||||
for move in inventory.move_ids:
|
||||
assert move.product_qty == 1.0,"Product quantity of move is not correspond."
|
||||
assert move.location_id.id == ref('location_inventory'),"Source location of move should be 'Inventory loss'"
|
||||
assert move.location_dest_id.id == ref('stock_location_components'),"Destination location of move is not correspond."
|
||||
-
|
||||
I check the inventory after validation.
|
||||
-
|
||||
!python {model: stock.inventory}: |
|
||||
inventory = self.browse(cr, uid, [ref('stock_physical_inventory0')])
|
||||
assert inventory[0].state == 'done',"After validate the inventory it should be in 'Done' state"
|
||||
assert inventory[0].state == 'done',"Inventory should be in 'Done' state"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'stock-overview'+format), 'wb+').write(data)
|
||||
-
|
||||
In order to test the PDF reports defined on a stock, we will print a Stock Picking List report
|
||||
In order to test the PDF reports defined on a stock, we will print a Delivery order List report
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
import netsvc, tools, os
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
-
|
||||
In order to test the scrap move, I add create a new move line in draft state with FAN2
|
||||
In order to test the scrap move, I create moves and scrap some quantities from those moves.
|
||||
-
|
||||
!record {model: stock.move, id: stock_move_4}:
|
||||
product_id: product.product_product_fan2
|
||||
|
@ -7,7 +7,7 @@
|
|||
location_dest_id: stock.stock_location_customers
|
||||
location_id: stock.stock_location_stock
|
||||
-
|
||||
Now, with the help of 'Scrap Move' wizard, I scap the move of same Quantity.
|
||||
I create a move and scrap some quantities from it.
|
||||
-
|
||||
!python {model: stock.move.scrap}: |
|
||||
context = {'active_model':'stock.move', 'active_id': ref('stock_move_4'), 'active_ids': [ref('stock_move_4')]}
|
||||
|
|
Loading…
Reference in New Issue