How to add custom field on any object in
OpenERP (Odoo) without doing any hardcode!!
Say for example we need a field
“Weight” on Vehicle.
Step 1: Activate Developers Mode.
a) To do that click on user name at
the right upper corner of your screen and select About OpenERP (Odoo)
option.
![]() |
Activate Developer Mode
b)
You will get window as shown in image below. Click on the link
Activate the developer mode.
Activate Developer Mode
c)
We will get a debug view From where we can edit all views of selected
object.
Debug View
Step
2: Identify your object
To
do that just hover your mouse on any of the field. It will show you
some information like field name, object, field type etc.
Field information
As
we know now that our object name is 'fleet.vehicle' and we have to
add a new field to this object say for example 'weight', type of
this field is integer. Let's edit our object. Here one thing is to
notice that these changes are for the existing database only, it will
not reflect in other database.
a)
Go to the menu Settings → Techniacl → Database Structure →
Models and search for fleet.vehicle
Object Search
b)
Open that object and click on edit, drag the mouse to reach bottom of
the page and click on Add an item link.
Object View
c)
Add all detail like field name, label, type then click on 'Save &
Close' button and finally click on Save button which is in Red
color.
Add new field
As a
field x_weight is added to our object fleet.vehicle we will now edit
different views of vehicle to see the changes.
Step
3: Edit View(Form, tree)
a)
Before editing excising views lets observe our current view.
Open
Vehicle form view and see there is not any field with label “Weight”
on it.
Vehicle's form view
without any Change
b)
Select the option Edit Form View from Debug View window.
Edit Form View
c)
You will get a window as below. Insert the new field to appropriate
position, and click on save button.
Insert new field
d)
Close the window and reload the page. Here we can notice that a new
field is on vehicle form view. Same way we can edit search, tree
view.
Vehicle's
form view with a new weight field
Cheers ENJOY OpenERP / ODOO !!
If I just made your day a little better then thank me with a coffee or maybe a pizza
Thanks,
Mayur Maheshwari( Odoo Developer)
What's app : +91 99245 42042
Mail : mayurmaheshwari07@gmail.com
Mayur Maheshwari( Odoo Developer)
What's app : +91 99245 42042
Mail : mayurmaheshwari07@gmail.com










