From f34bb6b30a4768f522f1feb8e7f23f791fe555a9 Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Tue, 29 Nov 2011 13:08:26 +0530 Subject: [PATCH] [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 --- addons/stock/__openerp__.py | 2 +- .../test/process/stock_chain_location.yml | 37 +++++++++ addons/stock/test/process/update_stock.yml | 52 ++----------- addons/stock/test/stock_test_wizard.yml | 78 ------------------- addons/stock/test/ui/physical_inventory.yml | 6 +- 5 files changed, 49 insertions(+), 126 deletions(-) create mode 100644 addons/stock/test/process/stock_chain_location.yml delete mode 100644 addons/stock/test/stock_test_wizard.yml diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py index 7ef40398683..6bdd77565d2 100644 --- a/addons/stock/__openerp__.py +++ b/addons/stock/__openerp__.py @@ -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', diff --git a/addons/stock/test/process/stock_chain_location.yml b/addons/stock/test/process/stock_chain_location.yml new file mode 100644 index 00000000000..30e134ccdbe --- /dev/null +++ b/addons/stock/test/process/stock_chain_location.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': ''}) + + diff --git a/addons/stock/test/process/update_stock.yml b/addons/stock/test/process/update_stock.yml index 7117fe669e8..e7cd514fe49 100644 --- a/addons/stock/test/process/update_stock.yml +++ b/addons/stock/test/process/update_stock.yml @@ -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': ''}) diff --git a/addons/stock/test/stock_test_wizard.yml b/addons/stock/test/stock_test_wizard.yml deleted file mode 100644 index 6c4d5ae12c2..00000000000 --- a/addons/stock/test/stock_test_wizard.yml +++ /dev/null @@ -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) - - diff --git a/addons/stock/test/ui/physical_inventory.yml b/addons/stock/test/ui/physical_inventory.yml index c061901f88c..3282694c4ac 100644 --- a/addons/stock/test/ui/physical_inventory.yml +++ b/addons/stock/test/ui/physical_inventory.yml @@ -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')])