Before we dive into this topic, let’s understand what is product variants in Odoo and the difference between Odoo product templates and Odoo Product Variants.
Product variants in Odoo are used to manage different attributes of products based on their colors, sizes, and brands.
- Product.template (Products Menu) is not an actual product; it is a Product template; whenever you create a product template, the same will be created in product variants. It contains the main product and a list of product variants (attributes).
- Product.product (Product Variants)- There are actual products with their variants as separate products; whenever you create SO or PO, you are using Product variants, not Products.
Product Template and Variant have different tables in the Database and are connected with the table reference.
Database Fields Storage for Product Template and Product Variants in Odoo
- The Product Template’s fields are stored in the “product_template” table (not the “product_product” table), but it is accessible on the product variant level as well.
- The Product Variant’s fields are stored in the “product_product” table (not the “product_template” table), and it is not accessible on the product template level.
Product Variant access Product Template’s field using the “product_tmpl_id” column (reference).
Set Custom Product Variant Field based on default Odoo UOM
We have come across many customers from different countries wanting to add a custom base price field for the product variant in Odoo.
In many countries, displaying a product’s base price online is mandatory. So, if you are a seller wanting to upload a product package of 300gms, you must show the base price for this product of 1 kg as an example.
Odoo Product Base Price:
Product Variant Odoo Base Price:
Default Odoo flow doesn’t include the base price calculation in the total product price, whether on the portal or the backend.
So, we tried to add a new field- base price, based on the sales price and UOM at the only product template level and display the same on the website portal.
But after testing the results, we encountered a limitation, if there are multiple variants for that product and any of the Product Variants in Odoo have some extra sales price or charges depending on the country or other rules. It will show the same sale price for all the variants.
So, to resolve this glitch, we added the base price field at the product variant level and fetched the base price calculation at the variant level.
If you have got any queries regarding the Odoo Product Variants customization, contact us for a demo.