Enable Dark Mode!
By: Niyas Raphy

How to Set Different Cost Price For Product Variants

Technical Sales

The product variant is a useful feature in Odoo. In this blog, I will be explaining how to set different cost price for the product variants. Before going to the topic, let me give a brief description of the product variant concept


What is Product variants?


We all know that some products will have different size and different flavors. How Odoo handles this changes in size or flavor or any other aspects?  Here comes the use of the product variant concept. Variant means, it is a shell or a template under which we can create more product with different features.

You can have a look at the video on How to create product variants in odoo 13

How to activate product variants?


Go to Sales -> Configuration -> Settings,

In the form, tick the option “Products can have several attributes, defining variants (Example: size, color,...)”



So the product variants feature is enabled. Now let us see how to set different cost price for product variants.


How to set different cost price for product variants?


By default in Odoo (Community edition), there is no such an option to set different cost price for product variants. But there is the option to set a different sale price for product variants. But in the real case, we may have to set different cost price for the product variants.


Consider an Example: Will a phone with internal memory 32 Gb and 64 Gb cost same? No, Definitely not. So how we will set the cost price in this case.


As it is not a default feature, how can we accomplish this? The answer is a simple customization.  What we have to do is, just remove an invisible attribute from the code.

Either it can be done by inheriting and creating a custom module, or by editing the original code. Here let us see how to edit the original code.



Editing the Code:

Open the product module product -> views -> product_views.xml.

In this file, there will be a record with the id “product_supplierinfo_form_view”. In this record, we have to change the following line,


<fieldname="product_id" domain="[('product_tmpl_id', '=',product_tmpl_id)]" invisible="1"/>



What we have to do is just remove invisible=”1” from the above line of code.

After removing that invisible attribute, the code will look like below.


<field name="product_id" domain="[('product_tmpl_id', '=', product_tmpl_id)]"/>


As the invisible attribute is removed the field becomes visible. But Where?


Go to

Sales -> Sales -> Product Variants.

Open a Product Variants from, then in the Inventory tab, add the cost price for the product variant in the Vendor section



If you need any assistance in odoo, we are online, please chat with us.



Hi Niyas Nice write-up. The question is: does this work properly with Odoo's costing methods (https://www.cybrosys.com/blog/product-costing-method-odoo)? Will these methods then apply to the product variants? Best, trevi




Leave a comment




Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635



Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.



Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message