Odoo ‐ Views - vec-ltd/odoo-docs GitHub Wiki

Views

This article demonstrates how to create a custom menu in Odoo 16 that links to a custom tree view, which includes a search view and a customized form view. We'll share techniques we've learned from working on Odoo projects, along with common components we frequently use when building these views.

ir.ui.view

...

1. Form

...

Header Button

I call this header button not really sure if that is the proper term but this is the buttons that are inside the header element usually these buttons can be seen on top of the form and most of the time it is being used to trigger some flags, state, status.

Things to note:

  • class: You can use bootstrap classes for this. Common usage is btn-primary this makes the button green.
  • string: Label of your button
  • attrs: Attributes that are attached to your button. Common usage is invisible, this hides the button if the the condition inside is True

Sample:

<header>
    <button class="btn-primary" name="set_approved" type="object" string="Approve" attrs="{'invisible': [('field_name', '=', True)]}"/>
</header>

Stat Button

... https://fontawesome.com/v4/icons/

Web Ribbon

...

Group

...

Notebook

...

2. Tree

...

3. Search

...

Searchable dropdown fields

...

Filters

...

Group by

...

ir.actions.act_window

1. Attaching tree and form view

2. Attaching search view

3. Attaching domain

4. All together

menuitem

...

1. Parent

...

2. Attaching action window

...

3. Sequencing

...

4. All together

...

manifest.py

Sequence of files

⚠️ **GitHub.com Fallback** ⚠️