Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Displaying product variant qty_available

Naroči se

Get notified when there's activity on this post

This question has been flagged
productecommercewebshopwebsitev18
1 Odgovori
342 Prikazi
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
Opusti
Codesphere Tech

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

Sebastiaan Schimmel
Avtor

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
Avtor

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
Avtor

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

Sebastiaan Schimmel
Avtor

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
Avtor

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
Opusti
Enjoying the discussion? Don't just read, join in!

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Text label for product reference price
product ecommerce webshop website
Avatar
Avatar
2
okt. 25
559
[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
dec. 23
2844
odoo 16 website eCommerce product image upload validations error
product ecommerce website
Avatar
Avatar
1
okt. 23
2986
Display Internal Reference on E-Commerce
product ecommerce website
Avatar
Avatar
Avatar
Avatar
Avatar
4
okt. 23
5778
Product Block on odoo website, hide the variant product
product ecommerce website_builder website
Avatar
Avatar
Avatar
2
okt. 24
3718
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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