<?xml version="1.0" encoding="UTF-8"?>
<odoo>
        <record id="view_op_batch_tree" model="ir.ui.view">
            <field name="name">op.batch.list</field>
            <field name="model">op.batch</field>
            <field name="priority" eval="8"/>
            <field name="arch" type="xml">
                <list string="Batch">
                    <field name="name"/>
                    <field name="code"/>
                    <field name="start_date"/>
                    <field name="end_date"/>
                    <field name="course_id"/>
                </list>
            </field>
        </record>

        <record id="view_op_batch_form" model="ir.ui.view">
            <field name="name">op.batch.form</field>
            <field name="model">op.batch</field>
            <field name="priority" eval="8"/>
            <field name="arch" type="xml">
                <form string="Batch">
                    <header/>
                    <sheet>
                        <field name="active" invisible="True"/>
                        <widget name="web_ribbon" title="Archived" bg_color="bg-danger"
                                invisible = "active == True"/>
                        <group>
                            <group name="main">
                                <field name="name"/>
                                <field name="start_date"/>
                                <field name="course_id"/>
                            </group>
                            <group>
                                <field name="code"/>
                                <field name="end_date"/>
                            </group>
                        </group>
                    </sheet>
                    <chatter/>
                </form>
            </field>
        </record>

        <record id="view_op_batch_search" model="ir.ui.view">
            <field name="name">op.batch.search</field>
            <field name="model">op.batch</field>
            <field name="priority" eval="8"/>
            <field name="arch" type="xml">
                <search string="Batch">
                    <field name="code"/>
                    <field name="name"/>
                    <field name="start_date"/>
                    <field name="end_date"/>
                    <field name="course_id"/>
                    <newline/>
                    <group>
                        <filter name="group_by_batch_start_date"
                                string="Start Date" domain="[]"
                                context="{'group_by':'start_date'}"/>
                        <filter name="group_by_batch_end_date"
                                string="End Date" domain="[]"
                                context="{'group_by':'end_date'}"/>
                        <filter name="group_by_batch_course"
                                string="Course" domain="[]" context="{'group_by':'course_id'}"/>
                        <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="view_op_batch_pivot" model="ir.ui.view">
            <field name="name">op.batch.pivot</field>
            <field name="model">op.batch</field>
            <field name="priority" eval="8"/>
            <field name="arch" type="xml">
                <pivot string="Batch">
                    <field name="name" type="row"/>
                    <field name="course_id"/>
                    <field name="start_date"/>
                    <field name="end_date"/>
                </pivot>
            </field>
        </record>


        <record model="ir.actions.act_window" id="act_open_op_batch_view">
            <field name="name">Batches</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">op.batch</field>
            <field name="path">batches</field>
            <field name="binding_view_types">form</field>
            <field name="view_mode">list,form,pivot</field>
            <field name="search_view_id" ref="view_op_batch_search"/>
            <field name="domain">[]</field>
            <field name="context">{}</field>
        </record>

        <record model="ir.actions.act_window.view" id="act_open_op_batch_view_form">
            <field name="act_window_id" ref="act_open_op_batch_view"/>
            <field name="sequence" eval="20"/>
            <field name="view_mode">form</field>
            <field name="view_id" ref="view_op_batch_form"/>
        </record>

        <record model="ir.actions.act_window.view" id="act_open_op_batch_view_tree">
            <field name="act_window_id" ref="act_open_op_batch_view"/>
            <field name="sequence" eval="10"/>
            <field name="view_mode">list</field>
            <field name="view_id" ref="view_op_batch_tree"/>
        </record>
</odoo>
