We can use Odoo Studio to add many different field types, and the process is basically the same for all of them. However, the relational fields are more complex, and there is more information here
Character (text) fields
Let’s add a text field to store the composition of a garment.
First step is enable Odoo Studio
Then we will drag a new text field on to the Form View for products:
You can drag it wherever you want on the current tab (and in Odoo 12 and later versions you can move it if you put it in the wrong place).
Note that the added field (initially) has a meaningless name
So the next thing to do is give the new field a meaningful name:
Notice that this will update the field name (“Technical Description”) and the “label”, which is the description shown on screen.
If you don’t change the name now, you will NOT be able to do it later (though you can change the “label” that is shown on the screen).
So now we have the new field available for use:
There are several options available to control the behaviour of the field:
- Read Only
All of these can be made “conditional” to give you more flexibility.
Making a field invisible
- For example, you might want to make this field invisible if this is a “service” item – and mandatory (required) if not.
Click on “Conditional” next to “Invisible” and the following window is displayed:
Click on “Add Filter” and then select “Product Type”
There are three possible values for “Product Type”, and we will make the field invisible if it’s a Service Item:
Note that the domain is shown in the “code editor” section. You can edit this if you wish!
Making a field mandatory (required)
Now we will make the field mandatory if it is a “storable” or “consumable” item.
Click on “Conditional” (next to “Required”):
Note the following:
- We select “ANY” (so either condition can be true).
- We select “Storable Product” and “Consumable”
- The domain is shown in the Code editor:
This is what now happens if we forget to enter the Composition:
Reviewing fields added in Studio
If we enable “Developer” mode and go to Settings / Technical / Fields we can check what has been added.
We can see that two fields have been created by Studio:
This is a special case. Odoo has two closely linked tables for:
- Product Template (product.template)
- Product (product.product)
If you don’t use variants, then these two tables will be the same.
If you do use variants, then the “parent” item is on
product.template and the variants (SKUs) are on
You can delete fields here if you added them by mistake:
Remember to remove them from all views first before deleting them (Odoo won’t allow you to delete them if they are used anywhere).
- Tip: you can search through the architecture of all views to find where a field is used.
You can also make some changes to field attributes.
3 thoughts on “Adding fields using Odoo Studio”
How can I edit BoM Structure & Cost report? I want to add more fields.
I haven’t used Odoo Studio very much to customize reports. It might be easier to add the fields to the Form View first and then you can add them to the reports. You could try the Odoo training
Thanks for the tutorial, I created a simple Sales module and a related Products page where when creating a new sale on the Sales page it would fetch the product price from the Products page via a Related Field. my problem is when I try to update a product’s price, it automatically updates all previous sale that include that product. is there a way to disable this?