Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consulting
    • Accounting Firm
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Solar Energy Systems
    • Shoe Maker
    • Serveis de neteja
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Displaying product variant qty_available

Subscriure's

Get notified when there's activity on this post

This question has been flagged
productecommercewebshopwebsitev18
1 Respondre
379 Vistes
Avatar
Sebastiaan Schimmel

I'm using Odoo v18 for my e-commerce website and I want to show the in stock status of products. The "Out-of-stock" message is only shown when a product is out of stock, it's too low on the page. Showing the quantity available is not what I need either.

For regular products that have no variants I'm able to use product.qty_available​ in the website_sale.product​ view. However when I have a product with multiple variants this can't be used as when at least one of the variants is in stock the product.qty_available​ will be higher than 0.

What I need is a way to access the qty_available​ for the specific variant that is selected.

I've tried product.product.qty_available​ but that gives me a internal server error. Accessing the combination info only works partially for the variant initially selected on page load but that doesn't update when a visitor selects a different variant.

Is there a way to access the selected variant's stock information on the product detail page in a way that it updates when a visitor selects a different variant?

0
Avatar
Descartar
Codesphere Tech

Hello,
You need to check the qty by product variant on shop page, right?

Sebastiaan Schimmel
Autor

Correct, on /shop/[PRODUCT]​. Where the customer can see the product details and click the add to cart button. I want to add the In stock notification just above the add to cart button.

Codesphere Tech

Review this :<t t-set="combination_info" t-value="variant_id._get_combination_info_variant()"/>. May be helpful for you..

Sebastiaan Schimmel
Autor

That results in a internal server error. There is no `variant_id`.

```
Error while render the template
KeyError: 'variant_id'
Template: website_sale.product
```

Codesphere Tech

Let you know if I got any solution..

Sebastiaan Schimmel
Autor

Correct and that needs to update when a customer selects different variant of the product

Sebastiaan Schimmel
Autor

So far I have been kind of get it to work with the code below. The problem is that this doesn't update when I a customer selects a different variant. `product_variant` doesn't get updated.

```
<t t-set="product_variant" t-value="product.env['product.product'].browse(combination_info['product_id'])"/>
<div t-if="(product_variant.sudo().qty_available or 0.0) &gt; 0">In stock</>
```

Codesphere Tech

You have to take vast changes in python, JS and XML for this.

Sebastiaan Schimmel
Autor

Bummer, where is the price update being done? That does change when a new product variant is changed.

I'm using Theme Prime. Maybe I can update that to include this.

Codesphere Tech

It is using this to display price
<span class="oe_price"
style="white-space: nowrap;"
t-out="combination_info['price']"
t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/>
When variant is changed the extra price of the product is included in this price using JS:
'change .js_main_product [data-attribute_exclusions]': 'onChangeVariant',
XML: <div class="js_product js_main_product mb-3">
Please debug into these things, you will get solution for this. Thanks

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,

In Odoo, the Quantity on Hand for a product with variants is managed at the variant level, not at the template level.

So, if you have multiple variants of a product, you need to open the specific variant to see its available quantity.


If quantities are not showing:


    Check that each variant is active and not archived.


    Go to Inventory → Reporting → Product Moves to confirm stock exists for that specific variant.


    Ensure you’re looking at the same warehouse and location where the stock is stored.


For a detailed walkthrough on configuring product variants, see the Cybrosys blog: https://www.cybrosys.com/blog/an-overview-of-product-variant-management-in-odoo-19


Also, there’s a relevant forum discussion about showing quantity on hand for variants: https://www.odoo.com/pl_PL/forum/pomoc-1/product-variants-and-quantity-on-hands-145671


Hope it helps

0
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
Text label for product reference price
product ecommerce webshop website
Avatar
Avatar
2
d’oct. 25
587
[SOLVED] E-commerce product description. Unique description, pictures and page for each product? Is this Possible? Solved
product ecommerce webshop website_builder website
Avatar
Avatar
Avatar
2
de des. 23
2864
odoo 16 website eCommerce product image upload validations error
product ecommerce website
Avatar
Avatar
1
d’oct. 23
3011
Display Internal Reference on E-Commerce
product ecommerce website
Avatar
Avatar
Avatar
Avatar
Avatar
4
d’oct. 23
5830
Product Block on odoo website, hide the variant product
product ecommerce website_builder website
Avatar
Avatar
Avatar
2
d’oct. 24
3747
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now