例如:addons/website_sale/sale_report_views.xml:
<record id="sale_report_view_pivot_website" model="ir.ui.view">
<field name="name">sale.report.view.pivot.website</field>
<field name="model">sale.report</field>
<field name="arch" type="xml">
<pivot string="Sales Analysis" sample="1">
<field name="date" type="row"/>
<field name="state" type="col"/>
<field name="price_subtotal" type="measure"/>
</pivot>
</field>
</record>
<record id="sale_report_action_dashboard" model="ir.actions.act_window">
<field name="name">Online Sales Analysis</field>
<field name="res_model">sale.report</field>
<field name="view_mode">pivot,graph</field>
<field name="domain">[('website_id', '!=', False)]</field>
<field name="context">{'search_default_confirmed': 1}</field>
<field name="search_view_id" ref="sale_report_view_search_website"/>
<field name="help" type="html">
<p class="o_view_nocontent_empty_folder">
You don't have any order from the website
</p>
</field>
</record>
<record id="sale_report_action_view_pivot_website" model="ir.actions.act_window.view">
<field name="sequence" eval="1"/>
<field name="view_mode">pivot</field>
<field name="view_id" ref="sale_report_view_pivot_website"/>
<field name="act_window_id" ref="sale_report_action_dashboard"/>
</record>
和
__manifest__.py
:
#...
'data': [
'views/sale_report_views.xml',
#...