<?xml version="1.0" encoding="utf-8"?>

<!--
  Copyright 2021 Akretion France (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="view_report_pos_order_search" model="ir.ui.view">
    <field name="model">report.pos.order</field>
    <field name="inherit_id" ref="point_of_sale.view_report_pos_order_search"/>
    <field name="arch" type="xml">
        <field name="product_categ_id" position="after">
            <field name="session_id"/>
        </field>
        <filter name="filter_date" position="before">
            <filter name="date_today" string="Today" domain="[('date', '&gt;=', (datetime.datetime.combine(context_today(), datetime.time(0, 0, 0))).strftime('%Y-%m-%d %H:%M:%S'))]"/>
            <filter name="date_yesterday" string="Yesterday" domain="[('date', '&gt;=', (datetime.datetime.combine(context_today() + relativedelta(days=-1), datetime.time(0, 0, 0))).strftime('%Y-%m-%d %H:%M:%S')), ('date', '&lt;', (datetime.datetime.combine(context_today(), datetime.time(0, 0, 0))).strftime('%Y-%m-%d %H:%M:%S'))]"/>
        </filter>
    </field>
</record>

<record id="point_of_sale.action_report_pos_order_all" model="ir.actions.act_window">
    <field name="view_mode">pivot,graph</field>  <!-- invert native order -->
</record>

<record id="view_report_pos_order_pivot" model="ir.ui.view">
    <field name="name">usability.report.pos.order.pivot</field>
    <field name="model">report.pos.order</field>
    <field name="inherit_id" ref="point_of_sale.view_report_pos_order_pivot"/>
    <field name="arch" type="xml">
        <!-- Remove order_id from default measures -->
        <field name="order_id" type="measure" position="replace"/>
    </field>
</record>

</odoo>
