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

    <!-- ===== Tree View ===== -->
    <record id="woo_customer_view_tree" model="ir.ui.view">
        <field name="name">woo.customer.tree</field>
        <field name="model">woo.customer</field>
        <field name="arch" type="xml">
            <list>
                <field name="instance_id"/>
                <field name="partner_id"/>
                <field name="woo_customer_id"/>
                <field name="woo_email"/>
                <field name="last_synced"/>
            </list>
        </field>
    </record>

    <!-- ===== Form View ===== -->
    <record id="woo_customer_view_form" model="ir.ui.view">
        <field name="name">woo.customer.form</field>
        <field name="model">woo.customer</field>
        <field name="arch" type="xml">
            <form>
                <sheet>
                    <group>
                        <group>
                            <field name="instance_id"/>
                            <field name="partner_id"/>
                            <field name="company_id" groups="base.group_multi_company"/>
                        </group>
                        <group>
                            <field name="woo_customer_id"/>
                            <field name="woo_email"/>
                            <field name="last_synced"/>
                        </group>
                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <!-- ===== Search View ===== -->
    <record id="woo_customer_view_search" model="ir.ui.view">
        <field name="name">woo.customer.search</field>
        <field name="model">woo.customer</field>
        <field name="arch" type="xml">
            <search>
                <field name="partner_id"/>
                <field name="woo_email"/>
                <separator/>
                <filter name="group_instance" string="Instance"
                        context="{'group_by': 'instance_id'}"/>
            </search>
        </field>
    </record>

    <!-- ===== Action ===== -->
    <record id="action_woo_customer" model="ir.actions.act_window">
        <field name="name">WooCommerce Customers</field>
        <field name="res_model">woo.customer</field>
        <field name="view_mode">list,form</field>
        <field name="search_view_id" ref="woo_customer_view_search"/>
    </record>

</odoo>
