[FIX] stock: added yml test case in order to check this fix
authorRifakat <rha@tinyerp.com>
Tue, 23 Oct 2012 11:19:09 +0000 (16:49 +0530)
committerRifakat <rha@tinyerp.com>
Tue, 23 Oct 2012 11:19:09 +0000 (16:49 +0530)
bzr revid: rha@tinyerp.com-20121023111909-a4mki07dplx7rpbu

addons/stock/product.py
addons/stock/test/stock_test.yml

index b162e94..81d136d 100644 (file)
@@ -261,6 +261,8 @@ class product_product(osv.osv):
         if prodlot_id:
             prodlot_clause = ' and prodlot_id = %s '
             where += [prodlot_id]
+        elif 'prodlot_id' in context and not prodlot_id:
+            prodlot_clause = 'and prodlot_id is null '
 
         # TODO: perhaps merge in one query.
         if 'in' in what:
index 762908e..6e52786 100644 (file)
           'product_uom': move.product_uom.id,
       }
    self.do_partial(cr, uid, [ref('stock_picking_0')],partial_datas)
+-
+  Now I will do some test on HP Pavilion Desktop PCs to check the qty with and without Production Lot.
+-
+  !python {model: stock.change.standard.price}: |
+    context.update({'active_model':'product.product', 'active_id': ref('product_product_hppaviliondesktoppcs0')})
+-
+  I am creating production lot '00001' for 'HP Pavilion Desktop PCs'
+-
+  !record {model: stock.production.lot, id: lot_hp_pc_1}:
+    name: 00001
+    product_id: product_product_hppaviliondesktoppcs0
+-
+  I update stock of 'HP Pavilion Desktop PCs' with 10 PCE in Stock with Production Lot.
+-
+  !record {model: stock.change.product.qty, id: update_qty_with_lot}:
+    location_id: stock_location_stock
+    new_quantity: 10
+    product_id: product_product_hppaviliondesktoppcs0
+    prodlot_id: lot_hp_pc_1
+-
+  Now I run the update wizard and update stock.
+-
+  !python {model: stock.change.product.qty}: |
+    self.change_product_qty(cr, uid, [ref('update_qty_with_lot')], context=context)
+-
+  I check real stock of 'HP Pavilion Desktop PCs'.
+-
+  !python {model: product.product}: |
+    product = self.browse(cr, uid, ref('product_product_hppaviliondesktoppcs0'), context=context)
+    assert product.qty_available == 20, "Real stock is not 20 PCE."
+-
+  The current stock of the 'HP Pavilion Desktop PCs' is 20 PCE.
+-
+  !record {model: stock.change.product.qty, id: update_qty_nolot}:
+    location_id: stock_location_stock
+    new_quantity: 10
+    product_id: product_product_hppaviliondesktoppcs0
+-
+  I try to update more 10 PCE in Stock without Production Lot.
+-
+  !python {model: stock.change.product.qty}: |
+    self.change_product_qty(cr, uid, [ref('update_qty_nolot')], context=context)
+-
+  I again check real stock of 'HP Pavilion Desktop PCs'.
+-
+  !python {model: product.product}: |
+    product = self.browse(cr, uid, ref('product_product_hppaviliondesktoppcs0'), context=context)
+    assert product.qty_available == 20, "Real stock is updated with 10 more PCE."
+-
+  I confirm available stock of 'HP Pavilion Desktop PCs' is still 20 PCE.
+