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 stock available for products in the product template of ODOO?

By
Gopakumar N G
on 3/9/15, 3:04 AM 824 views

I have inherited the product template and added stock available(Virtual Stock) in it.

<span t-if="product.virtual_available &gt; 0.00" t-field="product.virtual_available"/>

But for a product with variants the stock displaying is the sum of virtual stocks for all the variants. The product price which is already there which will will change perfectly on selecting the variants. For example if there two variants of a product 'A' called A1 and A2 and the price for them is 20,30 respectively, also the stock available is 1,2. If I select A1 the price shown will be 20 but the stock shown will be 3(1+2). I need to show the stock of the variant only.

2

Vasanth

--Vasanth--
3458
| 5 3 8
Pondicherry, India
--Vasanth--
Vasanth
On 3/9/15, 4:21 AM

Hi Gopakumar,

you can try this onchange methof for the selection of product variant:

    def onchange_product_id(self, cr, uid, ids, product_id=False, context=None):
        price = self.pool.get("product.product").browse(cr, uid, product_id).list_price if product_id else 0
        return {'value': {'price': price}}

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

3 follower(s)

Stats

Asked: 3/9/15, 3:04 AM
Seen: 824 times
Last updated: 4/11/16, 2:17 AM