<?xml version="1.0"?>
<odoo>
    <record id="loyalty_program_form_view" model="ir.ui.view">
        <field name="name">loyalty.program.form</field>
        <field name="model">loyalty.program</field>
        <field name="arch" type="xml">
            <form string="Loyalty Program">
                <sheet>
                    <div class="oe_title">
                        <label class="oe_edit_only" for="name"/>
                        <h1>
                            <field name="name" class="oe_inline"/>
                        </h1>
                    </div>

                    <group>
                        <group>
                            <field name="pp_product"/>
                            <field name="pp_currency"/>
                        </group>
                        <group>
                            <field name="pp_order"/>
                            <field name="rounding"/>
                        </group>
                    </group>

                    <separator string="Rules" colspan="4"/>
                    <p>Rules define how loyalty points are earned for specific products or categories</p>
                    <field name="rule_ids" colspan="4" nolabel="1">
                        <tree string="Rules">
                            <field name="name"/>
                            <field name="pp_product"/>
                            <field name="pp_currency"/>
                            <field name="cumulative"/>
                        </tree>
                    </field>

                    <separator string="Rewards" colspan="4"/>
                    <p>Reward the customer with gifts or discounts for loyalty points</p>
                    <field name="reward_ids" colspan="4" nolabel="1">
                        <tree string="Rewards">
                            <field name="name"/>
                            <field name="type"/>
                        </tree>
                    </field>
                </sheet>
            </form>
        </field>
    </record>

    <record id="loyalty_program_tree_view" model="ir.ui.view">
        <field name="name">loyalty.program.tree</field>
        <field name="model">loyalty.program</field>
        <field name="arch" type="xml">
            <tree string="Loyalty Programs">
                <field name="name"/>
            </tree>
        </field>
    </record>

    <record id="loyalty_program_action" model="ir.actions.act_window">
        <field name="name">Loyalty Programs</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">loyalty.program</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html">
            <p class="oe_view_nocontent_create">
                Click create to define a Loyalty Program.
            </p>
            <p>
                Loyalty Programs allow you customers to earn points
                and rewards when purchasing from your shops.
            </p>
        </field>
    </record>

    <menuitem parent="point_of_sale.menu_point_config_product"
              action="loyalty_program_action"
              id="loyalty_program_menu"
              sequence="30"
              groups="point_of_sale.group_pos_manager"/>
</odoo>