<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright 2018-2020 Akretion (http://www.akretion.com/)
  @author: Alexis de Lattre <alexis.delattre@akretion.com>
  License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

<odoo>


<record id="sale_report_tree" model="ir.ui.view">
    <field name="name">usability.sale.report.tree</field>
    <field name="model">sale.report</field>
    <field name="arch" type="xml">
        <tree string="Sales Analysis">
            <field name="name"/>
            <field name="date"/>
            <field name="commercial_partner_id"/>
            <field name="user_id"/>
            <field name="product_id"/>
            <field name="product_uom_qty" sum="1"/>
            <field name="qty_delivered" sum="1"/>
            <field name="qty_to_invoice" sum="1"/>
            <field name="product_uom" groups="uom.group_uom"/>
            <field name="price_subtotal" sum="1"/>
            <field name="state"/>
        </tree>
    </field>
</record>

<record id="sale.action_order_report_all" model="ir.actions.act_window">
    <field name="context">{'search_default_Sales': 1}</field>  <!-- Remove group_by_no_leaf, which breaks tree view -->
</record>

<record id="view_order_product_pivot" model="ir.ui.view">
    <field name="name">usability.sale.report.pivot</field>
    <field name="model">sale.report</field>
    <field name="inherit_id" ref="sale.view_order_product_pivot"/>
    <field name="arch" type="xml">
        <pivot position="attributes">
            <attribute name="disable_linking"></attribute>
        </pivot>
    </field>
</record>

<record id="view_order_product_search" model="ir.ui.view">
    <field name="name">usability.sale.report.search</field>
    <field name="model">sale.report</field>
    <field name="inherit_id" ref="sale.view_order_product_search"/>
    <field name="arch" type="xml">
        <field name="user_id" position="after">
            <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
        </field>
    </field>
</record>

<record id="sale.action_order_report_all" model="ir.actions.act_window">
    <!-- native order is graph,pivot -->
    <field name="view_mode">pivot,graph</field>
</record>

</odoo>
