[MRG] Improve requred yml changes and merge with lp:~openerp-dev/openobject-addons/trunk-wmsimplement-seduce-fp-inventory-test-fix-csn

bzr revid: tpa@tinyerp.com-20130829131408-4xocgbnhprsnab8k
This commit is contained in:
Turkesh Patel (Open ERP)
2013-08-29 18:44:08 +05:30
2 changed files with 33 additions and 38 deletions
+1
View File
@@ -1722,6 +1722,7 @@ class stock_inventory(osv.osv):
for inv in self.browse(cr, uid, ids, context=context):
if not inv.move_ids:
self.action_check(cr, uid, [inv.id], context=context)
inv.refresh()
move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context=context)
self.write(cr, uid, [inv.id], {'state': 'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
return True
+32 -38
View File
@@ -1,24 +1,32 @@
-
I create an inventory of 10 products
I create an inventory
-
!record {model: stock.inventory, id: inventory_test0}:
name: Test
inventory_line_id:
- product_id: product.product_product_3
product_qty: 10
location_id: stock.stock_location_14
-
I post this inventory
I start this inventory
-
!python {model: stock.inventory}: |
self.prepare_inventory(cr, uid, [ref('inventory_test0')], context=context)
-
I create an inventory line with 10 product
-
!record {model: stock.inventory.line, id: inventory_testline0}:
inventory_id: stock.inventory_test0
product_id: product.product_product_3
product_qty: 10
location_id: stock.stock_location_14
-
I confirm this inventory
-
!python {model: stock.inventory}: |
self.action_confirm(cr, uid, [ref('inventory_test0')], context=context)
self.action_done(cr, uid, [ref('inventory_test0')], context=context)
-
I check that this inventory has a stock.move and a quant
-
!python {model: stock.inventory}: |
inv = self.browse(cr, uid, ref('inventory_test0'), context=context)
assert len(inv.move_ids) == 1, "No move created for the inventory."
assert len(inv.move_ids) >= 1, "No move created for the inventory."
assert len(inv.move_ids[0].quant_ids) >= 1, "No quant created for this inventory"
-
I check that the quantity on hand is 10 on the location and it's parent.
@@ -38,21 +46,28 @@
product = self.browse(cr, uid, ref('product.product_product_3'), context=context)
assert product.qty_available==0, 'Expecting 0 products, got %.2f on location stock_location_components!' % (product.qty_available,)
-
I create an inventory of 20 products
I create another inventory
-
!record {model: stock.inventory, id: inventory_test1}:
name: Test
inventory_line_id:
- product_id: product.product_product_3
product_qty: 20
location_id: stock.stock_location_14
name: Test2
-
I post this new inventory
I start this inventory
-
!python {model: stock.inventory}: |
self.prepare_inventory(cr, uid, [ref('inventory_test1')], context=context)
-
I create an inventory line with 20 product on this new inventory
-
!record {model: stock.inventory.line, id: inventory_testline0}:
inventory_id: stock.inventory_test1
product_id: product.product_product_3
product_qty: 20
location_id: stock.stock_location_14
-
I confirm this inventory
-
!python {model: stock.inventory}: |
self.action_confirm(cr, uid, [ref('inventory_test1')], context=context)
self.action_done(cr, uid, [ref('inventory_test1')], context=context)
-
I check that the quantity on hand is 20 on the location and it's parent.
-
@@ -60,24 +75,3 @@
context['location'] = ref('stock.stock_location_14')
product = self.browse(cr, uid, ref('product.product_product_3'), context=context)
assert product.qty_available==20, 'Expecting 20 products, got %.2f on location stock_location_14!' % (product.qty_available,)
-
!record {model: stock.inventory, id: inventory_test2}:
name: Test
inventory_line_id:
- product_id: product.product_product_3
product_qty: 18
location_id: stock.stock_location_14
-
I post this new inventory
-
!python {model: stock.inventory}: |
self.action_confirm(cr, uid, [ref('inventory_test2')], context=context)
self.action_done(cr, uid, [ref('inventory_test2')], context=context)
-
I check that the quantity on hand is 18 on the location and it's parent.
-
!python {model: product.product}: |
context['location'] = ref('stock.stock_location_14')
product = self.browse(cr, uid, ref('product.product_product_3'), context=context)
assert product.qty_available==18, 'Expecting 18 products, got %.2f on location stock_location_14!' % (product.qty_available,)