Odoo Help

Welcome!

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.

0

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

By
oussama
on 11/6/14, 4:53 AM 500 views

Hi

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

_defaults={'sousse1":_default_stock_location}

Thanks

2

Baiju

--Baiju--
3154
| 5 4 8
Kochi, India
--Baiju--
ODOO technical and functional

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

oussama
on 11/6/14, 11:04 AM

plzz help

oussama
on 11/6/14, 11:32 AM

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

Baiju
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.

oussama
on 11/7/14, 3:51 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)

Stats

Asked: 11/6/14, 4:53 AM
Seen: 500 times
Last updated: 3/16/15, 8:10 AM