<?xml version="1.0"?>
<odoo>
        <record model="ir.ui.view" id="student_migrate_form">
            <field name="name">student.migrate.form</field>
            <field name="model">student.migrate</field>
            <field name="arch" type="xml">
                <form string="Student Migrate" version="7.0">
                    <sheet>
                        <group>
                            <group>
                                <field name="date"/>
                                <field name="course_completed"/>
                            </group>
                        </group>
                        <group class="mt-3">
                            <group>
                                <field name="course_from_id"/>
                                <field name="year_id"
                                       required="course_completed == False"
                                       invisible="course_completed == True"/>
                                <field name="optional_sub"/>
                            </group>
                            <group>
                                <field name="valid_to_course_ids" invisible="True"/>
                                <field name="course_to_id"
                                required="course_completed == False"
                                invisible="course_completed == True"
                                domain="[('id', 'in', valid_to_course_ids)]"/>
                                <field name="term_id"
                                       required="course_completed == False"
                                       invisible="course_completed == True"
                                       domain="[('academic_year_id', '=', year_id)]"/>
                                <field name="batch_id"
                                required="course_completed == False"
                                invisible="course_completed == True"
                                       domain="[('course_id','=', course_to_id)]"/>
                            </group>
                        </group>
                        <notebook>
                            <page string="Student(s)" name="students">
                                <field name="student_ids" nolabel="1"
                                       domain="[('id', 'in', student_ids_domain)]">
                                    <list>
                                        <field name="title"/>
                                        <field name="name"/>
                                        <field name="email"/>
                                    </list>
                                </field>
                            </page>
                        </notebook>
                    </sheet>
                    <footer>
                        <span groups="base.group_user">
                            <button name="student_migrate_forward" type="object"
                                    string="Forward" class="oe_highlight me-2"/>
                            <button string="Cancel" special="cancel"/>
                        </span>
                    </footer>
                </form>
            </field>
        </record>

        <record model="ir.actions.act_window" id="act_open_student_migrate_view">
            <field name="name">Student Migration</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">student.migrate</field>
            <field name="binding_view_types">form</field>
            <field name="view_mode">form</field>
            <field name="target">new</field>
            <field name="domain">[]</field>
            <field name="context">{}</field>
        </record>

        <record model="ir.actions.act_window.view" id="act_open_student_migrate_view_form">
            <field name="act_window_id" ref="act_open_student_migrate_view"/>
            <field name="sequence" eval="20"/>
            <field name="view_mode">form</field>
            <field name="view_id" ref="student_migrate_form"/>
        </record>
</odoo>
