This question has been flagged
1 Reply
2800 Views

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

Avatar
Discard
Best Answer

Better start using v8.0, they have addressed this query in this new version.

Avatar
Discard
Author

Thanks Mitul for your reply ,I use v7 because the module intercompany is not working in v8