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

        <record id="view_op_marksheet_register_tree" model="ir.ui.view">
            <field name="name">op.marksheet.register.list</field>
            <field name="model">op.marksheet.register</field>
            <field name="priority" eval="8"/>
            <field name="arch" type="xml">
                <list string="Marksheet Register">
                    <field name="exam_session_id"/>
                    <field name="generated_date"/>
                    <field name="generated_by"/>
                    <field name="state"/>
                    <field name="total_pass"/>
                    <field name="total_failed"/>
                    <field name="name"/>
                </list>
            </field>
        </record>

        <record id="view_op_marksheet_register_form" model="ir.ui.view">
            <field name="name">op.marksheet.register.form</field>
            <field name="model">op.marksheet.register</field>
            <field name="priority" eval="8"/>
            <field name="arch" type="xml">
                <form string="Marksheet Register">
                    <header groups="openeducat_exam.group_op_exam_admin">
                        <button name="action_validate" invisible="state != 'draft'" string="Validate Marksheet" type="object"
                                class="oe_highlight"/>
                        <button name="act_draft" invisible="state != 'cancelled'" string="Set to Draft" type="object"/>
                        <button name="act_cancel" invisible="state != 'draft'" type="object" string="Cancel"/>
                        <field name="state" widget="statusbar" statusbar_visible="draft,validated,cancelled"/>
                    </header>
                    <sheet>
                        <field name="active" invisible="1"/>
                        <widget name="web_ribbon" title="Archived" bg_color="bg-danger"
                                invisible="active == True"/>
                        <group>
                            <group>
                                <field name="name"/>
                                <field name="generated_by"/>
                                <field name="total_pass"/>
                                <field name="result_template_id"/>
                            </group>
                            <group>
                                <field name="exam_session_id"/>
                                <field name="generated_date"/>
                                <field name="total_failed"/>
                            </group>
                        </group>
                        <separator string="Marksheets" colspan="4"/>
                        <group colspan="4">
                            <field name="marksheet_line" colspan="2" nolabel="1"/>
                        </group>
                    </sheet>
                   <chatter/>
                </form>
            </field>
        </record>

        <record id="view_op_marksheet_register_search" model="ir.ui.view">
            <field name="name">op.marksheet.register.search</field>
            <field name="model">op.marksheet.register</field>
            <field name="priority" eval="8"/>
            <field name="arch" type="xml">
                <search string="Marksheet Register">
                    <field name="exam_session_id"/>
                    <field name="generated_date"/>
                    <field name="generated_by"/>
                    <field name="state"/>
                    <field name="total_pass"/>
                    <field name="total_failed"/>
                    <field name="name"/>
                    <filter string="Archived" name="inactive"
                            domain="[('active', '=', False)]"/>
                    <newline/>
                    <group>
                        <filter string="Exam Session"
                                name="group_by_marksheet_register_exam_session"
                                domain="[]" context="{'group_by':'exam_session_id'}"/>
                        <filter string="Generated By"
                                name="group_by_marksheet_register_generated_by"
                                domain="[]" context="{'group_by':'generated_by'}"/>
                        <filter string="Status"
                                name="group_by_marksheet_register_generated_by"
                                domain="[]" context="{'group_by':'state'}"/>
                        <filter string="Total Pass"
                                name="group_by_marksheet_register_total_pass"
                                domain="[]" context="{'group_by':'total_pass'}"/>
                        <filter string="Total Fail"
                                name="group_by_marksheet_register_total_failed"
                                domain="[]" context="{'group_by':'total_failed'}"/>
                        <filter string="Marksheet Register"
                                name="group_by_marksheet_register_name"
                                domain="[]" context="{'group_by':'name'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record model="ir.actions.act_window" id="act_open_op_marksheet_register_view">
            <field name="name">Marksheet Registers</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">op.marksheet.register</field>
            <field name="path">marksheet-register</field>
            <field name="binding_view_types">form</field>
            <field name="view_mode">list,form</field>
            <field name="search_view_id" ref="view_op_marksheet_register_search"/>
            <field name="domain">[]</field>
            <field name="context">{}</field>
        </record>

        <record model="ir.actions.act_window.view" id="act_open_op_marksheet_register_view_form">
            <field name="act_window_id" ref="act_open_op_marksheet_register_view"/>
            <field name="sequence" eval="20"/>
            <field name="view_mode">form</field>
            <field name="view_id" ref="view_op_marksheet_register_form"/>
        </record>

        <record model="ir.actions.act_window.view" id="act_open_op_marksheet_register_view_tree">
            <field name="act_window_id" ref="act_open_op_marksheet_register_view"/>
            <field name="sequence" eval="10"/>
            <field name="view_mode">list</field>
            <field name="view_id" ref="view_op_marksheet_register_tree"/>
        </record>

</odoo>
