[FIX] stock: recompute the qty_available based on the location instead of using the one in the result of the browse (opw 606423)

The qty_available field is a function field that uses the information of the context (eg: location) to compute the value. Using the global browse record would return the same qty_available value for each location (and then produce way too many account.move)

bzr revid: mat@openerp.com-20140429124256-ljph37kijosg5dqb
This commit is contained in:
Martin Trigaux 2014-04-29 14:42:56 +02:00
parent 9806fd4225
commit 9cf14197ac
1 changed files with 3 additions and 1 deletions

View File

@ -105,7 +105,9 @@ class product_product(osv.osv):
'compute_child': False
})
qty = product.qty_available
# qty_available depends of the location in the context
qty = self.read(cr, uid, [product.id], ['qty_available'], context=c)[0]['qty_available']
diff = product.standard_price - new_price
if not diff: raise osv.except_osv(_('Error!'), _("No difference between standard price and new price!"))
if qty: