How to Create a form view odoo 8

Greetings Everyone,

In this blog-post, you will learn how to create a Form View in an Odoo 8 module.

What is Form View in Odoo?

  • Form views are used to display the data from a single record.
  • Forms are used to create and edit single records.
  • The root element of a form view is <form>.
  • It consists  of regular HTML with additional structural and semantic components.
  • It is composed of high-level structure elements (groups, notebooks) and interactive elements (buttons and fields)

Example of a Form View :-

Earlier in my previous blog-post, I had created a Model to collect student’s information. Now I will create a Form View for the student model which will give it a User Interface from where entry can be created or edited.

Code for creating a Form View


		<!-- Form View for Student -->
		<record id="student_form_view" model="ir.ui.view">
			<field name="name">student.form.view</field>
			<field name="model">student.student</field>
			<field name="arch" type="xml">
						<field name="image" widget="image" class="oe_left oe_avatar"/>
						 <h2><field name="name" placeholder="Name"/></h2>
						 <group string="Student Information">
						 		<field name="email"/>
						 		<field name="contact"/>
						 		<field name="dob"/>
						 		<field name="course_id"/>
						 		<field name="registration_date"/>
						 		<field name="gender"/>
						 		<field name="is_physically_disabled"/>
						 		<field name="hobby_ids" widget="many2many_tags"></field>
							<page string="Qualification">
								<field name="qualification_ids">
											<field naame="course_id"/>
									 		<field name="year_cleared"/>
									 		<field name="grade"/>
										<field name="course_id"/>
								 		<field name="year_cleared"/>
								 		<field name="grade"/>

Steps for creating Form View in Odoo

  • All views are stored in the database, in the ir.model.view model. To add a view in a module, we declare a <record> element describing the view in an XML file that will be loaded into the database when the module is installed.
  • The root element of a Form View is <form>
  • <sheet> tag is used to give the form a responsive layout
  • <group> is used to define column layouts in forms. By default, groups define 2 columns and most direct children of groups take a single column.
  • <field> direct children of groups display a label by default, and the label and the field itself have a colspan of 1 each.
  • <notebook> defines a tabbed section. Each tab is defined through a page child element.

SnapShot of Eclipse IDE:-

form view odoo module
Form View – Editable mode – Click on the image to enlarge
Form View - Editable mode - Click on the image to enlarge
Form View – Read-only Mode – Click on the image to enlarge

form view odoo module

form view odoo module

Hope you learnt how to create a Form View in Odoo module, your reviews/comments/suggestions/doubts are most welcomed, please comment in the section below, and subscribe to the newsletter to receive timely future updates of this blog.

Now next, Learn how to create a Tree View in Odoo 8.

Thank You

By Burhan Vakharia

Having 6+ years of experience working on Odoo with projects covering several business verticles like Retail industry, Manufacturing, Service, Rental, Education, Medical and many more. I am having experience working on Odoo projects from several countries across the globe.

Leave a Reply

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

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/odootech/public_html/wp-includes/functions.php on line 4759

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/odootech/public_html/wp-includes/functions.php on line 4759