[FIX] stock: get only quants from your company. It means that when moving goods from company A to company B through a transit warehouse (without visibility on the other company), openerp will create a quant for company B instead of reusing the one from company A (which is the expected behavior as the history shouldn't be visible, the cost may be different...)

bzr revid: qdp-launchpad@openerp.com-20140312134751-7384c3vm9wpg7htl
This commit is contained in:
Quentin (OpenERP) 2014-03-12 14:47:51 +01:00
parent 881577bd87
commit 7565cf79ea
1 changed files with 7 additions and 1 deletions

View File

@ -555,8 +555,14 @@ class stock_quant(osv.osv):
''' Implementation of removal strategies
If it can not reserve, it will return a tuple (None, qty)
'''
if context is None:
context = {}
domain += location and [('location_id', 'child_of', location.id)] or []
domain += [('product_id', '=', product.id)] + domain
domain += [('product_id', '=', product.id)]
if context.get('force_company'):
domain += [('company_id', '=', context.get('force_company'))]
else:
domain += [('company_id', '=', self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id)]
#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))