Startup Stock Photo

How-To: Adding 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.

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

How To - Add a field (Step 1)

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.

How To - Add a field (Step 3)

How To - Add a field (Step 4)

 

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

How To - Add a field (Step 6)

 

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.

How To - Add a field (Step 7)

 

Step 4: Make the field appear in your form
Select a customer to have the customer form appear. Then select the “Edit Form View” as shown below:

How To - Add a field (Step 8)

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.

How To - Add a field (Step 9)

!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

How To - Add a field (Step 10)

 

 

Posted in How-To and tagged , , , , , , , .

Leave a Reply

Your email address will not be published. Required fields are marked *