Pivot view
Odoo supports several views. such as tree view, form view, list view, Kanban view,
pivot view, calendar view etc. The pivot view is used to visualize aggregations
as a pivot table. Its root element is <pivot>
Let’s create a pivot view:
Created a model book.
class Book(models.Model):
_name = 'book'
display_name = fields.Char(string='Name', required=True)
author = fields.Many2one('res.users', 'Author', required=True)
sl_no = fields.Char('Sl No', required=True)
Created an action for this model
<record id="action_Book" model="ir.actions.act_window">
<field name="name">Book</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">book</field>
<field name="view_mode">tree,form,pivot</field>
</record>
This is the pivot view of this model
<record id="view_book_pivot" model="ir.ui.view">
<field name="name">book.pivot</field>
<field name="model">book</field>
<field name="arch" type="xml">
<pivot string="Project Tasks">
<field name="author" type="row"/>
<field name="state" type="col"/>
</pivot>
</field>
</record>