Odoo Help


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

on 11/6/14, 4:53 AM 732 views


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

I use this code

 def _default_stock_location(self, cr, uid, context=None):       
        location_obj = self.pool.get('stock.location')
        count = location_obj.search(cr, uid, [('company_id', '=', 'sousse1')], context=context)  
        for a in count:
            record=location_obj.browse(cr, uid, a, context=context).stock_real
        return record

_colmuns= {'sousse1' : fields.float('Sousse1'), }




Baiju KS

--Baiju KS--
| 5 5 8
Kochi, India
--Baiju KS--
ODOO technical

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju KS
On 11/6/14, 10:13 AM

you can use this code to get product quantity of any location by its id:

context1.update({'states': ['done'], 'what': ('in', 'out'), 'location': 18})

result = prod_obj_pool.get_product_available(cr, uid, [obj.product_id.id], context=context1)

Give location id and product id.

Thanks for your reply where can i use this code,can you give me a function.

on 11/6/14, 11:04 AM

plzz help

on 11/6/14, 11:32 AM

can you please give more details of your need???

Baiju KS
on 11/6/14, 11:30 PM

I have one location for each company my question is how to display for example the quantity of stock for company "sousse1" in my view tree of model product.product. thanks.

on 11/7/14, 3:51 AM

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/6/14, 4:53 AM
Seen: 732 times
Last updated: 3/16/15, 8:10 AM