Creating the form view

All views are stored in the database, in the ir.ui.view model. To add a view to a module, we declare a <record> element describing the view in an XML file, which is to be loaded into the database when the module is installed.

Add this new views/todo_view.xml file to define our form view:

<?xml version="1.0"?> 
<odoo> 
  <record id="view_form_todo_task" model="ir.ui.view"> 
    <field name="name">To-do Task Form</field> 
    <field name="model">todo.task</field> 
    <field name="arch" type="xml"> 
      <form string="To-do Task"> 
        <group>
          <field name="name"/> 
          <field name="is_done"/> 
          <field name="active" readonly="1"/> 
        </group> 
      </form> 
    </field> 
  </record> 
</odoo> 

The ir.ui.view record has values for three fields: name, model, and arch. Another ...

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.