[FIX] stock: packing yaml tests fixed
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Mon, 24 Feb 2014 15:37:55 +0000 (16:37 +0100)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Mon, 24 Feb 2014 15:37:55 +0000 (16:37 +0100)
bzr revid: qdp-launchpad@openerp.com-20140224153755-m9n1efw5h8c2ihgf

addons/stock/test/packing.yml
addons/stock/test/packingneg.yml

index ac61011..c85e2b0 100644 (file)
     self.do_prepare_partial(cr, uid, backorder_ids, context=context)
     picking = self.browse(cr, uid, backorder_ids[0])
     assert len(picking.pack_operation_ids) == 2, "Wrong number of pack operation"
-    assert picking.pack_operation_ids[0].product_qty == 100, "Wrong quantity in pack operation"
-    assert picking.pack_operation_ids[0].package_id.name == 'Pallet 2', "Wrong pallet in pack operation"
-    assert picking.pack_operation_ids[1].product_qty == 50, "Wrong quantity in pack operation"
-    assert picking.pack_operation_ids[1].package_id.name == 'Pallet 3', "Wrong pallet in pack operation"
+    for pack_op in picking.pack_operation_ids:
+        assert pack_op.product_qty == 1, "Wrong quantity in pack operation (%s found instead of 1)" % (pack_op.product_qty)
+        assert pack_op.package_id.name in ('Pallet 2', 'Pallet 3'), "Wrong pallet info in pack operation (%s found)" % (pack_op.package_id.name)
     self.action_assign(cr, uid, backorder_ids, context=context)
     self.do_transfer(cr, uid, backorder_ids, context=context)
 - 
index a36ba72..d42cbfa 100644 (file)
   !python {model: stock.picking}: |
     self.do_transfer(cr, uid, [ref('delivery_order_neg')], context=context)
 - 
-  Check the quants that you have 120 pieces pallet 1 in customers, -20 pieces pallet 2 in stock and 120 and 20 with customers and 20/30 in stock, 10 in customers from pallet 3 
+  Check the quants that you have 120 pieces pallet 1 in customers, -20 pieces pallet 2 in stock, 120 + 20 pieces 2 in customer with lot, and a total quantity of 50 in stock from pallet 3 (should be 20+30, as it has been split by reservation), finally 10 in customers from pallet 3
 - 
   !python {model: stock.quant}: |
     reco_id = self.search(cr ,uid , [('product_id','=',ref('product_neg'))], context=context)
+    pallet_3_stock_qty = 0
     for rec in self.browse(cr, uid, reco_id, context=context):
       if rec.package_id.name == 'Palneg 1' and rec.location_id.id == ref('stock_location_customers'):
         assert rec.qty == 120, "Should have 120 pieces on pallet 1"
       elif rec.lot_id.name == 'Lot neg' and rec.location_id.id == ref('stock_location_customers'):
         assert ((rec.qty == 20 or rec.qty == 120) and not rec.package_id), "Should have 140 pieces (120+20) in customer location from pallet 2 and lot A"
       elif rec.package_id.name == 'Palneg 3' and rec.location_id.id == ref('stock_location_stock'):
-        assert rec.qty == 50, "Should have 50 pieces in stock on pallet 3"
+        pallet_3_stock_qty += rec.qty
       elif not rec.package_id and not rec.lot_id and rec.location_id.id == ref('stock_location_customers'):
         assert rec.qty == 10, "Should have 10 pieces in customer location from pallet 3"
       else:
         assert False, "Unrecognized quant"
+    assert pallet_3_stock_qty == 50, "Should have 50 pieces in stock on pallet 3"
 - 
   Create a picking for reconciling the negative quant
 -