O'Reilly logo

Odoo Development Cookbook by Daniel Reis, Alexandre Fayolle, Holger Brunn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding content and widgets to a form view

The previous recipe showed how to pick a specific view for an action. Now we'll demonstrate how to make the form we defined previously more useful.

How to do it...

  1. Define the form view basic structure:
    <record id="form_all_customers" model="ir.ui.view">
      <field name="name">All customers</field>
      <field name="model">res.partner</field>
      <field name="arch" type="xml">
        <form>
          <!--form content goes here -->
        </form>
      </field>
    </record>
  2. To add a head bar, usually used for action buttons and stage pipeline, add inside the form:
          <header>
            <button type="object" 
                    name="open_commercial_entity"
                    string="Open commercial partner"       
                    class="oe_highlight" />
          </header>
  3. Add fields to the form, using group tags to visually organize them: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required