[IMP,MOVE]stock:

Move stock_test_wizard.yml => process/stock_chain_location.yml
remove chain location code from update_stock.yml and put it in right place
update the __openerp__.py

bzr revid: dbr@tinyerp.com-20111129073826-x09k58mxyji548yx
This commit is contained in:
DBR (OpenERP)
2011-11-29 13:08:26 +05:30
parent 28e78e8348
commit f34bb6b30a
5 changed files with 49 additions and 126 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ Thanks to the double entry management, the inventory controlling is powerful and
'test': [
'test/ui/physical_inventory.yml',
'test/process/update_stock.yml',
#'test/stock_test_wizard.yml',
'test/process/stock_chain_location.yml',
'test/process/stock_demo_backorder.yml',
'test/process/scrap_move.yml',
'test/ui/stock_report.yml',
@@ -0,0 +1,37 @@
-
In order to test the 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, '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]})
-
I check stock moves of product 'Sprouting Foods'.
-
!python {model: stock.move}: |
ids = self.search(cr, uid, [('product_id','=',ref('product.product_product_sprouting'))])
for i in self.browse(cr, uid, ids):
assert i.product_qty >= 1,"Product is not correspond"
if i.location_id.name == 'Inventory loss':
assert i.location_dest_id.name == 'Refrigerated Vehicles',"Destination location must be 'Refrigerated Vehicles'"
if i.location_id.name == 'Refrigerated Vehicles':
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': ''})
+8 -44
View File
@@ -1,40 +1,39 @@
-
In order to test the stock module, I will update the current stock of the product.
In order to test the stock module, I will update the current stock of the product '[CPU2]High speed processor config'.
-
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 '[CPU2]High speed processor config' product.
-
!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 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.
I take '[CPU2]High speed processor config' product and with the help of 'Change Product Quantity' wizard update the product stock.
-
!python {model: stock.change.product.qty}: |
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')}
fields = {'location_id' : ref('stock_location_stock'), 'new_quantity': 5, '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'
assert product.qty_available == 5,'Product Quantity is not Updated'
-
I trace the Stock Production Lot for product CPU2
I trace the stock production lot for '[CPU2]High speed processor config' product.
-
!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.
I check physical inventory created.
-
!python {model: stock.inventory.line}: |
ids = self.search(cr, uid, [('product_id','=',ref('product.product_product_cpu2'))])
inventory = self.browse(cr, uid, ids)[0]
assert inventory.product_id.id == ref('product.product_product_cpu2'), 'Product is not correspond'
assert inventory.product_qty == 2,'product Quantity is not correspond'
assert inventory.product_qty == 5,'product Quantity is not correspond'
assert inventory.location_id.id == ref('stock_location_stock'), 'Location is not correspond'
assert inventory.state == 'done', 'State should be in Done state'
-
@@ -43,39 +42,4 @@
!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!'
-
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, '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]})
-
I check stock moves of product 'Sprouting Foods'.
-
!python {model: stock.move}: |
ids = self.search(cr, uid, [('product_id','=',ref('product.product_product_sprouting'))])
for i in self.browse(cr, uid, ids):
assert i.product_qty >= 1,"Product is not correspond"
if i.location_id.name == 'Inventory loss':
assert i.location_dest_id.name == 'Refrigerated Vehicles',"Destination location must be 'Refrigerated Vehicles'"
if i.location_id.name == 'Refrigerated Vehicles':
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': ''})
-78
View File
@@ -1,78 +0,0 @@
-
I create stock.tracking record.
-
!record {model: stock.tracking, id: stock_tracking_0}:
move_ids:
- product_id: product.product_product_pc1
product_qty: 5.0
product_uom: product.product_uom_unit
location_id : stock.stock_location_suppliers
location_dest_id: stock.stock_location_shop0
name : '[PC1] Basic PC'
date_expected : !eval time.strftime('%Y-%m-%d %H:%M:%S')
name: 0000007
active: True
date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
-
I trace the information of a product.
-
!python {model: stock.tracking}: |
self.name_get(cr, uid, [ref('stock_tracking_0')],{'lang': 'en_US', 'tz': False, 'active_model': 'ir.ui.menu', 'field': '', 'type': ''})
self.action_traceability(cr,uid,[ref('stock_tracking_0')], {'lang': 'en_US', 'tz': False, 'active_model': 'ir.ui.menu', 'field': '', 'type': ''})
-
I creat stock.move Record
-
!record {model: stock.move, id: stock_move_test0}:
location_dest_id: stock.stock_location_shop0
product_id: product.product_product_pc1
product_qty: 5.0
product_uom: product.product_uom_unit
date_expected : !eval time.strftime('%Y-%m-%d %H:%M:%S')
location_id : stock.stock_location_suppliers
name : '[PC1] Basic PC'
company_id: base.main_company
product_uos_qty : 5.0
name: IN/00010
state: assigned
-
I Check onchange function of stock.move object
-
!python {model: stock.move }: |
self.onchange_lot_id(cr, uid, [ref("stock_move_test0")], ref("stock.stock_production_lot0"), 5, ref("stock.stock_location_suppliers"), ref("product.product_product_pc1"), ref("product.product_uom_unit"), None)
self.onchange_quantity(cr, uid, [ref("stock_move_test0")], ref("product.product_product_pc1"), 10, ref("product.product_uom_unit"), ref("product.product_uom_unit"))
self.onchange_uos_quantity(cr, uid, [ref("stock_move_test0")], ref("product.product_product_pc1"), 10, ref("product.product_uom_unit"), ref("product.product_uom_unit"))
self.onchange_product_id(cr, uid, [ref("stock_move_test0")], ref("product.product_product_pc1"), ref("stock.stock_location_suppliers"), ref("stock.stock_location_shop0"), False)
-
I Check _getSSCC and action_partial_move function of stock.move object
-
!python {model: stock.move }: |
context = {"lang": 'en_US', "default_location_dest_id": ref("stock.stock_location_shop0"), "active_model":
"stock.move", "search_default_receive": 1, 'product_receive': True, "default_location_id": ref("stock.stock_location_suppliers"),"active_ids":[ref("stock_move_test0")], "tz": False, "active_id":ref("stock_move_test0")}
self._getSSCC(cr, uid , context)
self.action_partial_move(cr, uid , [ref("stock_move_test0")], context)
-
I check write function
-
!python {model: stock.move }: |
vals = {"product_qty" : 2, "product_uos_qty": 2}
self.write(cr, uid, [ref("stock_move_test0")], vals, {"lang": 'en_US', "default_location_dest_id": ref("stock.stock_location_shop0"), "active_model":
"ir.ui.menu", "search_default_receive": 1, 'product_receive': True, "default_location_id": ref("stock.stock_location_suppliers"),"active_ids":[ref("stock_move_tree")], "tz": False, "active_id":ref("stock_move_tree")})
-
I check default function
-
!python {model: stock.move }: |
self.name_get(cr, uid, [ref("stock_move_test0")], {"lang": 'en_US', "default_location_dest_id": ref("stock.stock_location_shop0"), "active_model":
"stock.move", "search_default_receive": 1, 'product_receive': True, "default_location_id": ref("stock.stock_location_suppliers"),"active_ids":[ref("stock_move_test0")], "tz": False, "active_id":ref("stock_move_test0")})
ctx = {"lang": 'en_US', "default_location_dest_id": ref("stock.stock_location_shop0"), "active_model":
"ir.ui.menu", "search_default_receive": 1, 'product_receive': True, "default_location_id": ref("stock.stock_location_suppliers"),"active_ids":[ref("view_move_form_reception_picking")], "tz": False, "active_id":ref("view_move_form_reception_picking")}
self._default_location_destination(cr, uid, ctx)
self._default_location_source(cr, uid, ctx)
+3 -3
View File
@@ -1,5 +1,5 @@
-
I create a record for physical inventory.
I create a record for 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
@@ -24,7 +24,7 @@
except:
pass
-
I confirm the Inventory.
I confirm the inventory.
-
!python {model: stock.inventory}: |
inventory = self.browse(cr, uid, [ref('stock_physical_inventory0')])
@@ -34,7 +34,7 @@
assert line.product_qty == 0.0,"Product Quantity should be Zero"
self.action_done(cr,uid,[ref('stock_physical_inventory0')])
-
I check the Inventory after Validate.
I check the inventory after validation.
-
!python {model: stock.inventory}: |
inventory = self.browse(cr, uid, [ref('stock_physical_inventory0')])