<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="view_pos_payment_form" model="ir.ui.view">
        <field name="name">pos.payment.form</field>
        <field name="model">pos.payment</field>
        <field name="arch" type="xml">
            <form string="Payments" create="0" edit="0" delete="0">
                <sheet>
                    <group>
                        <field name="currency_id" invisible="1" />
                        <field name="name" />
                        <field name="amount" />
                        <field name="pos_order_id" readonly="1"/>
                        <field name="payment_method_id" readonly="1"/>
                        <field name="card_type" readonly="1" attrs="{'invisible': [('card_type', '=', False)]}"/>
                        <field name="cardholder_name" readonly="1" attrs="{'invisible': [('cardholder_name', '=', False)]}"/>
                        <field name="transaction_id" readonly="1" attrs="{'invisible': [('transaction_id', '=', False)]}"/>
                        <field name="session_id" />
                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <record id="view_pos_payment_tree" model="ir.ui.view">
        <field name="name">pos.payment.tree</field>
        <field name="model">pos.payment</field>
        <field name="arch" type="xml">
            <tree string="Payments" create="0" delete="0">
                <field name="currency_id" invisible="1" />
                <field name="payment_date"/>
                <field name="payment_method_id" />
                <field name="pos_order_id" />
                <field name="amount" />
            </tree>
        </field>
    </record>

    <record id="view_pos_payment_search" model="ir.ui.view">
        <field name="name">pos.payment.search.view</field>
        <field name="model">pos.payment</field>
        <field name="arch" type="xml">
            <search string="Payments">
                <field name="name"/>
                <field name="amount"/>
                <field name="pos_order_id" />
                <group expand="0" string="Group By">
                    <filter name="group_by_payment_method" string="Payment Method" domain="[]"  context="{'group_by':'payment_method_id'}"/>
                    <filter name="group_by_session" string="Session" domain="[]"  context="{'group_by':'session_id'}"/>
                </group>
            </search>
        </field>
    </record>

    <record id="action_pos_payment_form" model="ir.actions.act_window">
        <field name="name">Payments</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">pos.payment</field>
        <field name="view_mode">tree,kanban,form</field>
        <field name="view_id" eval="False"/>
        <field name="domain">[]</field>
        <field name="context">{'search_default_group_by_payment_method': 1}</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_empty_folder">
                No orders found
            </p><p>
                To record new orders, start a new session.
            </p>
        </field>
    </record>

    <menuitem id="menu_pos_payment" parent="menu_point_of_sale" action="action_pos_payment_form" sequence="3" groups="group_pos_manager,group_pos_user"/>
</odoo>
