Tutorial: Inherit Pivot and Graph Views
Learn how to modify pivot/graph views with custom measures
Pivot View
Graph View
Measures
Overview
This tutorial module teaches you how to inherit existing pivot and graph views in Odoo and add custom measures for enhanced analytics and reporting.
What You'll Learn
- Adding custom fields to sale.order and sale.order.line
- Extending the sale.report model (PostgreSQL VIEW)
- Overriding _select_additional_fields() and _group_by_sale()
- Inheriting pivot and graph views with XPath
- Adding custom measures and filters
Contains
- Custom fields: probability, kickback_fee, monthly_profit
- Extended sale.report model with new measures
- Modified Sales Analysis pivot view
- Modified Sales Analysis graph view
- New search filters for custom fields
Key Code Examples
Extending Report Model
def _select_additional_fields(self):
res = super()._select_additional_fields()
res['custom_field'] = 's.custom_field'
return res
Adding Measure to Pivot
<xpath expr="//pivot" position="inside">
<field name="monthly_profit" type="measure"/>
</xpath>
Technical Information
Tutorial: Inherit Pivot and Graph Views
Learn how to modify pivot/graph views with custom measures
Pivot View
Graph View
Measures
Overview
This tutorial module teaches you how to inherit existing pivot and graph views in Odoo and add custom measures for enhanced analytics and reporting.
What You'll Learn
- Adding custom fields to sale.order and sale.order.line
- Extending the sale.report model (PostgreSQL VIEW)
- Overriding _select_additional_fields() and _group_by_sale()
- Inheriting pivot and graph views with XPath
- Adding custom measures and filters
Contains
- Custom fields: probability, kickback_fee, monthly_profit
- Extended sale.report model with new measures
- Modified Sales Analysis pivot view
- Modified Sales Analysis graph view
- New search filters for custom fields
Key Code Examples
Extending Report Model
def _select_additional_fields(self):
res = super()._select_additional_fields()
res['custom_field'] = 's.custom_field'
return res
Adding Measure to Pivot
<xpath expr="//pivot" position="inside">
<field name="monthly_profit" type="measure"/>
</xpath>
Technical Information
Version: 19.0.1.0.0
Dependencies: sale
License: OPL-1
Please log in to comment on this module