Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
7363 Vizualizări

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.

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
iul. 20
10991
1
mai 16
4943
3
iul. 15
10680
1
mar. 21
11266
2
aug. 20
8604