Hi
how to add quantity of stock for a specific location in each product to view tree
I use this code
def get_stock_locations(self, cr, uid, ids, field_names=None, arg=None, context=None):
res = {}
if not ids: return res
location_obj = self.pool.get('stock.location')
count = location_obj.search(cr, uid, [('usage', '=', 'internal'),('company_id', '=', 'sousse1')], context=context)
for record in location_obj.browse(cr, uid, count, context=context):
res[record.id] = {'stock_real': 0.0}
res[record.id]['stock_real'] = record.stock_real
return res
'sousse1': fields.function(get_stock_locations, type='float', string='Sousse1'),
Thanks