From 95b6ce63eb12865949fea7473eea93e268d003e0 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Tue, 18 Feb 2014 10:12:22 +0100 Subject: [PATCH] [FIX] Change remaining qty bzr revid: jco@openerp.com-20140218091222-so0xw06wy9y400z6 --- addons/stock/stock.py | 4 ++-- addons/stock/test/packingneg.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index cf6da7f3ddd..85b50d35634 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -3343,11 +3343,11 @@ class stock_pack_operation(osv.osv): res = {} for ops in self.browse(cr, uid, ids, context=context): res[ops.id] = 0 - if ops.package_id: + if ops.package_id and not ops.product_id: #dont try to compute the remaining quantity for packages because it's not relevant (a package could include different products). #should use _get_remaining_prod_quantities instead continue - elif ops.product_id: + else: qty = ops.product_qty if ops.product_uom_id: qty = uom_obj._compute_qty(cr, uid, ops.product_uom_id.id, ops.product_qty, ops.product_id.uom_id.id) diff --git a/addons/stock/test/packingneg.yml b/addons/stock/test/packingneg.yml index 8887e9b5a56..3f663394bbd 100644 --- a/addons/stock/test/packingneg.yml +++ b/addons/stock/test/packingneg.yml @@ -106,7 +106,7 @@ 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 30 and 20 pieces in stock on pallet 3" + assert rec.qty == 50 or rec.qty == 20 or rec.qty == 30, "Should have 30 and 20 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: