How to add a field on Odoo

How to add a field on Odoo 

This is a sample “sales” module of Odoo version 8, loaded with demo data.
Under the “sales” module, “Sales/Customers” label, I have opened “Michel Fletcher” customer form for the example.

Customisation Needed: I want to be able to enter the contact’s Personal Mobile Phone in a separate field.


Step 1: Enable technical features
Under the “Settings” module, “Users/Users”, select the administrator profile and enable “Technical Features”


Step 2: Activate the developer mode
This ensures that previously hidden features in various menus are now visible.




Step 3: Add a field in the database
Under “Settings” module, “Technical/Database Structure/Fields”, choose to "Create" new "field"



Choose a Field Name with no capital letters or space. This is the “code” that references the new field. This name will be use to call the field in the customer form (refer to step 4). Make sure you keep the “x_” value as you will be able to identify easily fields you manually added.

Under the Field Label, choose the actual name you want the field to have on your form.
Under Field Type, choose “char” for a text field
Under Model, type “res.partner” and select “Partner” in the drop down list. This link the new field with the form in which you want the field to appear.


Step 4: Make the field appear in your form

Warning: The method described below, is for "education" purpose only. It is to understand how the views are described in xml and rendered. Practically to make a field appear in a view, it is better to use a view that inherits from the original view

Select a customer to have the customer form appear. Then select the “Edit Form View” as shown below:


In the XML sheet that appears, look for the word “phone.” If you add your new field just beneath, it will appear at the same place in the customer form as well.


Be careful and make sure you add the field in the right place in the XML file. Compare the customer form and XML to make sure it is the right place!

Your field is now created in the Customer Form




Customise invoice printout - Odoo Qweb 101