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

        <record id="view_op_exam_session_tree" model="ir.ui.view">
            <field name="name">op.exam.session.list</field>
            <field name="model">op.exam.session</field>
            <field name="priority" eval="8"/>
            <field name="arch" type="xml">
                <list string="Exam Session">
                    <field name="name"/>
                    <field name="exam_code"/>
                    <field name="start_date"/>
                    <field name="end_date"/>
                    <field name="course_id" optional="show"/>
                    <field name="batch_id" optional="show"/>
                    <field name="exam_type" optional="show"/>
                    <field name="evaluation_type" optional="show"/>
                    <field name="venue" optional="show"/>
                    <field name="state"/>
                </list>
            </field>
        </record>

        <record id="view_op_exam_session_form" model="ir.ui.view">
            <field name="name">op.exam.session.form</field>
            <field name="model">op.exam.session</field>
            <field name="priority" eval="8"/>
            <field name="arch" type="xml">
                <form string="Exam Session" >
                    <header groups="base.group_user">
                        <button name="act_draft" invisible="state not in ['held', 'schedule', 'cancel']" type="object"
                                string="Draft" class="oe_highlight"/>
                        <button name="act_schedule" invisible="state != 'draft'" type="object"
                                string="Schedule" class="oe_highlight"/>
                        <button name="act_held" invisible="state != 'schedule'" type="object"
                                string="Held" class="oe_highlight"/>
                        <button name="act_done" invisible="state not in ['schedule', 'held']" type="object"
                                string="Done" class="oe_highlight"/>
                        <button name="act_cancel" invisible="state not in ['schedule', 'held']" type="object"
                                string="Cancel"/>
                        <button name="%(openeducat_exam.action_student_hall_ticket_report)d"
                                type="action"
                                string="Student Hall Tickets"
                                class="btn-primary"
                                icon="fa-file-pdf-o" invisible="state != 'schedule'"/>
                        <field name="state" widget="statusbar"
                               statusbar_visible="draft,held,scheduled,done"/>
                    </header>
                    <sheet>
                    <div name="button_box" class="oe_button_box">
                            <button name="get_exam" type="object" class="oe_stat_button" icon="fa-book" string="exam">
                                <field name="exams_count" widget="statinfo" />
                            </button>
                        </div>
                        <field name="active" invisible="1"/>
                        <widget name="web_ribbon" title="Archived" bg_color="bg-danger"
                                invisible="active == True"/>
                        <group>
                            <group>
                                <field name="name" select="1" readonly="state in ['held', 'done', 'cancel']"/>
                                <field name="start_date" readonly="state in ['held', 'done', 'cancel']"/>
                                <field name="course_id" readonly="state in ['held', 'done', 'cancel']" />
                                <field name="exam_type" readonly="state in ['held', 'done', 'cancel']"/>
                                <field name="venue" domain="[('is_venue','=',True)]" required="1" readonly="state in ['held', 'done', 'cancel']"/>
                            </group>
                            <group>
                                <field name="exam_code" readonly="state in ['held', 'done', 'cancel']"/>
                                <field name="end_date" readonly="state in ['held', 'done', 'cancel']"/>
                                <field name="batch_id" context="{'course_id': course_id,'get_parent_batch':1}" readonly="state in ['held', 'done', 'cancel']"/>
                                <field name="evaluation_type" readonly="state in ['held', 'done', 'cancel']"/>
                            </group>
                        </group>
                    </sheet>
                    <chatter/>
                </form>
            </field>
        </record>

        <record id="view_op_exam_session_search" model="ir.ui.view">
            <field name="name">op.exam.session.search</field>
            <field name="model">op.exam.session</field>
            <field name="priority" eval="8"/>
            <field name="arch" type="xml">
                <search string="Exam Session">
                    <field name="name" select="True"/>
                    <field name="exam_code" select="True"/>
                    <field name="start_date" select="True"/>
                    <field name="end_date" select="True"/>
                    <field name="course_id" select="True"/>
                    <field name="batch_id" select="True"/>
                    <field name="venue"/>
                    <filter string="Archived" name="inactive"
                            domain="[('active', '=', False)]"/>
                </search>
            </field>
        </record>
        <record model="ir.ui.view" id="view_op_exam_session_pivot">
            <field name="name">op.exam.session.pivot</field>
            <field name="model">op.exam.session</field>
            <field name="arch" type="xml">
                <pivot string="Exam Session Pivot">
                    <field name="name" type="row"/>
                    <field name="exam_code" string="exam Code"/>
                    <field name="course_id" string="Course"/>
                    <field name="batch_id" string="Batch"/>
                    <field name="state" type="col"/>
                </pivot>
            </field>
        </record>

        <record id="view_op_exam_session_calendar_view" model="ir.ui.view">
            <field name="name">op.exam.session.calender.view</field>
            <field name="model">op.exam.session</field>
            <field name="arch" type="xml">
                <calendar string="Exam Session" event_open_popup="True"
                          date_start="start_date" date_stop="end_date" mode="month" quick_create="False"
                          color="name">
                    <field name="name"/>
                    <field name="course_id"/>
                </calendar>
            </field>
        </record>

        <record model="ir.actions.act_window" id="act_open_op_exam_session_view">
            <field name="name">Exam Sessions</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">op.exam.session</field>
            <field name="path">exam-session</field>
            <field name="binding_view_types">form</field>
            <field name="view_mode">list,form,calendar,pivot</field>
            <field name="search_view_id" ref="view_op_exam_session_search"/>
            <field name="domain">[]</field>
            <field name="context">{}</field>
        </record>

        <record model="ir.actions.act_window.view" id="act_open_op_exam_session_view_form">
            <field name="act_window_id" ref="act_open_op_exam_session_view"/>
            <field name="sequence" eval="20"/>
            <field name="view_mode">form</field>
            <field name="view_id" ref="view_op_exam_session_form"/>
        </record>

        <record model="ir.actions.act_window.view" id="act_open_op_exam_session_view_tree">
            <field name="act_window_id" ref="act_open_op_exam_session_view"/>
            <field name="sequence" eval="10"/>
            <field name="view_mode">list</field>
            <field name="view_id" ref="view_op_exam_session_tree"/>
        </record>

</odoo>
