Odoo Help


This community 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.


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

on 11/4/14, 4:59 AM 646 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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


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