From e0ecc24f336dcff22e831714a25d546b728cdc16 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Thu, 30 Jan 2014 11:05:20 +0100 Subject: [PATCH] [FIX]quant tracability: It is not logical that a quant that was brought to Inventory Loss, can be reused in a random way to bring back in stock lp bug: https://launchpad.net/bugs/1272005 fixed bzr revid: csn@openerp.com-20140130100520-daxf6fnequfjukv5 --- addons/stock/stock.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 899d253e70c..26f99f0d8b8 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -377,9 +377,13 @@ class stock_quant(osv.osv): the choice on the quants that match the prefered_domain as well. But if the qty requested is not reached it tries to find the remaining quantity by using the fallback_domain. ''' + if domain is None: + domain = [] + #don't take into account location that are production, supplier or inventory + ignore_location_ids = self.pool.get('stock.location').search(cr, uid, [('usage', 'in', ('production', 'supplier', 'inventory'))], context=context) + domain.append(('location_id','not in',ignore_location_ids)) if prefered_domain and fallback_domain: - if domain is None: - domain = [] + quants = self.quants_get(cr, uid, location, product, qty, domain=domain + prefered_domain, restrict_lot_id=restrict_lot_id, restrict_partner_id=restrict_partner_id, context=context) res_qty = qty quant_ids = []