Add base price for product variants in odoo - aktivsoftwarecom/Odoo GitHub Wiki
Before we dive into this topic, let’s understand the difference between product templates and product variants in Odoo.
- 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 with list of product variants (attributes).
- Product.product (Product Variants)- There are actual products with their variants as a separate product; 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 “product_tmpl_id” column (reference).
## Custom Product Variant Field based on default Odoo UOM We have had come across many customers from different countries wanting to add a custom base price field for the product variants.
For many countries, it is mandatory to display a base price of the product displayed online. So, if you are a seller wanting to upload a product package of 300gms, you must show the base price for this product 1 kg as an example.
### Product Base Price:
### Variant Base Price:
Default Odoo flow doesn’t include the base price calculation in the total product price, whether on the portal or 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 has 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 customization, contact us for a demo.
Note: Check out the original version of this article: https://www.aktivsoftware.com/base-price-for-product-variants-in-odoo/