Skip to Content
Menu
This question has been flagged
1 Reply
3810 Views

I can´t find the function get_product_available in Odoo 8.0.

How can  i get the available quantity for a specific product in a specific location on a specific date in Odoo 8.0?

OpenERP 7 function call:

qty = product_obj.get_product_available(cr, uid, [product.id], context ={'location' : location_id.id, 'states': ('done',), 'what': ('in', 'out'), 'to_date': to_date })[product.id]

Avatar
Discard
Best Answer

In Odoo 8 you analyze model stock.quant. For example fetch all quants  and sum quantity.

quants = self.env['stock.quant'].search([('location_id','=',self.id),('product_id','=?',FOO_ID)])
for quant in quants:
     qty += quant.qty


Avatar
Discard
Author

Your solution sums up the current quantity in that location, i need the quantity on a specific date.

I gave an example only. See how works stock.hostory report, file stock_account/wizard/stock_valuation_history.py

Related Posts Replies Views Activity
0
Nov 24
8
0
Nov 24
142
2
Aug 24
934
0
Aug 24
327
2
Aug 24
475