Odoo Help


how to add quantity of stock for a specific location in each product to view tree

on 11/4/14, 4:59 AM 706 views


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'),


On 11/4/14, 8:32 AM

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

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

on 11/4/14, 8:35 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 11/4/14, 4:59 AM
Seen: 706 times
Last updated: 3/16/15, 8:10 AM