From 28a3c2b6282644221863e6b98884126371fa9ded Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 3 Sep 2013 14:18:30 +0200 Subject: [PATCH] [FIX] stock: packing.yml bzr revid: qdp-launchpad@openerp.com-20130903121830-dmfsw9lov70pg31c --- addons/stock/stock.py | 4 ++-- addons/stock/test/packing.yml | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 4e1d4310b6d..bfe1af7caa3 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -840,7 +840,7 @@ class stock_picking(osv.osv): for move in res2.keys(): if res2[move] > 0: mov = stock_move_obj.browse(cr, uid, move, context=context) - newmove_id = stock_move_obj.split(cr, uid, mov, res2[move], context=context) + stock_move_obj.split(cr, uid, mov, res2[move], context=context) stock_move_obj.action_done(cr, uid, extra_moves + [x.id for x in orig_moves], context=context) picking.refresh() self._create_backorder(cr, uid, picking, context=context) @@ -848,7 +848,7 @@ class stock_picking(osv.osv): def do_split(self, cr, uid, picking_ids, context=None): """ - just spit the picking without making it 'done' + just split the picking without making it 'done' """ if context is None: context = {} diff --git a/addons/stock/test/packing.yml b/addons/stock/test/packing.yml index 234b00e78e9..44112c8f831 100644 --- a/addons/stock/test/packing.yml +++ b/addons/stock/test/packing.yml @@ -48,9 +48,9 @@ package3 = stock_quant_pack.create(cr, uid, {'name': 'Pallet 3'}, context=context) #Create package for each line and assign it as result_package_id #create pack operation - stock_pack.write(cr, uid, record.pack_operation_ids[0].id, {'package_id': package1, 'result_package_id': package1, 'product_qty': 120}) - new_pack1 = stock_pack.create(cr, uid, {'product_id': ref('product1'), 'product_uom_id': ref('product.product_uom_unit'), 'picking_id': ref('pick1'), 'lot_id': lot_a, 'package_id': package2, 'result_package_id': package2, 'product_qty': 120}, context=context) - new_pack2 = stock_pack.create(cr, uid, {'product_id': ref('product1'), 'product_uom_id': ref('product.product_uom_unit'), 'picking_id': ref('pick1'), 'package_id': package3, 'result_package_id': package3, 'product_qty': 60}, context=context) + stock_pack.write(cr, uid, record.pack_operation_ids[0].id, {'result_package_id': package1, 'product_qty': 120}) + new_pack1 = stock_pack.create(cr, uid, {'product_id': ref('product1'), 'product_uom_id': ref('product.product_uom_unit'), 'picking_id': ref('pick1'), 'lot_id': lot_a, 'result_package_id': package2, 'product_qty': 120}, context=context) + new_pack2 = stock_pack.create(cr, uid, {'product_id': ref('product1'), 'product_uom_id': ref('product.product_uom_unit'), 'picking_id': ref('pick1'), 'result_package_id': package3, 'product_qty': 60}, context=context) - Use button rereserve and check the qtyremaining on the moves are correct (=original quantities) - @@ -72,7 +72,7 @@ assert len(reco_id) == 3, "The number of quants created is not correct" for rec in self.browse(cr, uid, reco_id, context=context): if rec.package_id.name == 'Pallet 1': - assert rec.qty == 120, "Should have 120 pîeces on pallet 1" + assert rec.qty == 120, "Should have 120 pieces on pallet 1" elif rec.package_id.name == 'Pallet 2': assert rec.qty == 120, "Should have 120 pieces on pallet 2" elif rec.package_id.name == 'Pallet 3': @@ -133,10 +133,16 @@ for rec in self.browse(cr, uid, reco_id, context=context): if rec.package_id.name == 'Pallet 1' and rec.location_id.id == ref('stock_location_customers'): assert rec.qty == 120, "Should have 120 pieces on pallet 1" - if rec.package_id.name == 'Pallet 2' and rec.location_id.id == ref('stock_location_stock'): - assert rec.qty == 20, "Should have 20 pieces in stock on pallet 2" - if rec.package_id.name == 'Pallet 3' and rec.location_id.id == ref('stock_location_stock'): - assert rec.qty == 10, "Should have 10 pieces in stock on pallet 3" + elif rec.package_id.name == 'Pallet 2' and rec.location_id.id == ref('stock_location_stock'): + assert rec.qty == 100, "Should have 100 pieces in stock on pallet 2" + elif rec.lot_id.name == 'Lot A' and rec.location_id.id == ref('stock_location_customers'): + assert (rec.qty == 20 and not rec.package_id), "Should have 20 pieces in customer location from pallet 2" + elif rec.package_id.name == 'Pallet 3' and rec.location_id.id == ref('stock_location_stock'): + assert rec.qty == 50, "Should have 50 pieces in stock on pallet 3" + 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" - Check a backorder was created and on that backorder, prepare partial and add an op with 20 pieces (20 that cannot be assigned) with lot B -