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

    <!-- Agreement Service Profile List View-->
    <record id="agreement_serviceprofile_tree" model="ir.ui.view">
        <field name="name">Agreement Service Profile Tree</field>
        <field name="model">agreement.serviceprofile</field>
        <field name="arch" type="xml">
            <tree string="Service Profiles" default_order='agreement_id'>
                <field name="name"/>
                <field name="agreement_id"/>
                <field name="active" invisible="1"/>
            </tree>
        </field>
    </record>

    <!-- Agreement Service Profile Form View -->
    <record id="agreement_serviceprofile_form" model="ir.ui.view">
        <field name="name">Agreement Service Profile Form</field>
        <field name="model">agreement.serviceprofile</field>
        <field name="arch" type="xml">
            <form string="Service Profile">
                <sheet>
                    <div class="oe_button_box" name="button_box">
                        <button name="toggle_active" type="object"
                                class="oe_stat_button" icon="fa-archive">
                            <field name="active" widget="boolean_button"
                                   options="{'terminology': 'archive'}"/>
                        </button>
                    </div>
                    <div class="oe_title">
                        <label for="name" class="oe_edit_only"/>
                        <h1>
                            <field name="name"/>
                        </h1>
                    </div>
                    <group>
                        <group>
                            <field name="agreement_id"/>
                        </group>
                        <group></group>
                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <!-- Agreement Service Profile Search View -->
    <record id="agreement_serviceprofile_search" model="ir.ui.view">
        <field name="name">Agreement Service Profile Search</field>
        <field name="model">agreement.serviceprofile</field>
        <field name="arch" type="xml">
            <search>
                <filter string="Agreement" name="group_agreement"
                        icon="terp-partner"
                        context="{'group_by':'agreement_id'}"/>
            </search>
        </field>
    </record>

    <!-- Actions opening views on models -->
    <record id="agreement_serviceprofile_action" model="ir.actions.act_window">
        <field name="name">Service Profiles</field>
        <field name="res_model">agreement.serviceprofile</field>
        <field name="view_mode">tree,form</field>
    </record>

    <menuitem
            name="Service Profiles"
            id="agreement_serviceprofiles"
            parent="agreement_legal.agreement_masterdata"
            sequence="50"
            action="agreement_serviceprofile_action"/>

</odoo>