<odoo>
    <record model="ir.ui.view" id="super_coop_partner_inherited_view_form">
        <field name="name">Partner Super Coop</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form" />
        <field name="priority">50</field>
        <field name="arch" type="xml">
            <xpath expr="//sheet" position="before">
                <header>
                    <button
                        name="coop_subscribe"
                        string="Subscribe to shift"
                        class="oe_highlight"
                        type="object"
                        groups="shift.group_shift_management"
                        attrs="{'invisible': [('is_worker', '=', False)]}"
                    />
                    <button
                        name="auto_extension"
                        string="Auto Extension"
                        class="oe_highlight"
                        type="object"
                        groups="shift.group_shift_attendance"
                        attrs="{'invisible': ['|',
                                                    ('is_worker', '=', False),
                                                    '|',
                                                        ('state', '!=', 'suspended'),
                                                        ('extension_start_time', '!=', False)]}"
                    />
                    <button
                        name="manual_extension"
                        string="Manual Extension"
                        class="oe_highlight"
                        type="object"
                        groups="shift.group_shift_management"
                        attrs="{'invisible': ['|',
                                                    ('is_worker', '=', False),
                                                    '|',
                                                        ('state', '!=', 'suspended'),
                                                        ('extension_start_time', '=', False)]}"
                    />
                    <button
                        name="coop_unsubscribe"
                        string="Unsubscribe"
                        class="oe_highlight"
                        type="object"
                        groups="shift.group_shift_management"
                        attrs="{'invisible': [('is_worker', '=', False)]}"
                    />
                    <button
                        name="register_holiday"
                        string="Register Holidays"
                        class="oe_highlight"
                        type="object"
                        groups="shift.group_shift_management"
                        attrs="{'invisible': ['|', ('is_worker', '=', False), ('state', '=', 'resigning')]}"
                    />
                    <button
                        name="temporary_exempt"
                        string="Temporary Exemption"
                        type="object"
                        groups="shift.group_shift_management"
                        attrs="{'invisible': ['|', ('is_worker', '=', False), ('state', '=', 'unsubscribed')]}"
                    />
                    <field
                        name="state"
                        widget="statusbar"
                        attrs="{'invisible': [('is_worker', '=', False)]}"
                    />
                </header>
            </xpath>
            <xpath expr="//field[@name='vat']" position="before">
                <field name="is_worker" />
                <field name="can_shop" />
            </xpath>
            <xpath expr="//notebook" position="inside">
                <page
                    string="Worker information"
                    attrs="{'invisible': [('is_worker', '=', False)]}"
                    name="work"
                >
                    <group name="info_session" />
                    <group>
                        <group>
                            <field name="info_session" />
                            <field
                                name="info_session_date"
                                attrs="{'invisible': [('info_session', '=', False)]}"
                            />
                            <field
                                name="extension_start_time"
                                attrs="{'invisible': [('extension_start_time', '=', False)]}"
                            />
                        </group>
                        <group>
                            <field name="working_mode" />
                            <field
                                name="exempt_reason_id"
                                attrs="{'invisible':[('working_mode', '!=', 'exempt')]}"
                            />
                            <field name="super" />
                        </group>
                    </group>
                    <separator string="Subscribed Shift" />
                    <field name="subscribed_shift_ids" />
                    <separator string="Shifts" groups="shift.group_shift_attendance" />
                    <field name="shift_shift_ids" />
                </page>
            </xpath>
        </field>
    </record>

    <record model="ir.ui.view" id="coop_status_form_view">
        <field name="name">Coop Status Form View</field>
        <field name="model">cooperative.status</field>
        <field name="arch" type="xml">
            <form>
                <header>
                    <field name="status" widget="statusbar" />
                </header>
                <group>
                    <group string="General information">
                        <field name="cooperator_id" />
                        <field name="super" />
                        <field name="working_mode" />
                        <field
                            name="irregular_start_date"
                            attrs="{'invisible':[('working_mode', '!=', 'irregular')]}"
                        />
                        <field
                            name="irregular_absence_date"
                            attrs="{'invisible':[('working_mode', '!=', 'irregular')]}"
                        />

                        <field
                            name="exempt_reason_id"
                            attrs="{'invisible':[('working_mode', '!=', 'exempt')]}"
                        />
                    </group>
                    <group string="Counter and Status">
                        <field name="info_session" />
                        <field name="info_session_date" />
                        <field name="sr" />
                        <field name="sc" />
                        <field
                            name="irregular_absence_counter"
                            attrs="{'invisible':[('working_mode', '!=', 'irregular')]}"
                        />
                        <field name="unsubscribed" />
                        <field name="resigning" />
                        <field name="can_shop" />
                    </group>
                    <group string="Timing information">
                        <field name="next_shift_id" />
                        <field name="next_shift_date" />
                        <field
                            name="next_countdown_date"
                            readonly="1"
                            attrs="{'invisible':[('working_mode', '!=', 'irregular')]}"
                        />
                        <field
                            name="future_alert_date"
                            readonly="1"
                            attrs="{'invisible':[('working_mode', '!=', 'irregular')]}"
                        />
                        <field
                            name="is_subscribed_to_shift"
                            readonly="1"
                            attrs="{'invisible':[('working_mode', '!=', 'irregular')]}"
                        />
                        <field name="time_extension" />
                        <field name="holiday_start_time" />
                        <field name="holiday_end_time" />
                        <field name="alert_start_time" />
                        <field name="extension_start_time" />
                    </group>
                    <group string="Temporary Exemption">
                        <field name="temporary_exempt_reason_id" />
                        <field name="temporary_exempt_start_date" />
                        <field name="temporary_exempt_end_date" />
                    </group>
                </group>
                <group groups="base.group_no_one" col="3">
                    <separator string="For testing purpose only" colspan="3" />
                    <field name="today" />
                    <button name="clear_history" type="object" string="Clear History" />
                </group>
                <separator string="History" colspan="2" />
                <field name="history_ids">
                    <tree>
                        <field name="create_date" string="Date" />
                        <field name="type" />
                        <field name="change" />
                        <field name="user_id" />
                    </tree>
                </field>
            </form>
        </field>
    </record>

    <record model="ir.ui.view" id="coop_status_tree_view">
        <field name="name">Coop Status Tree view</field>
        <field name="model">cooperative.status</field>
        <field name="arch" type="xml">
            <tree>
                <field name="cooperator_id" />
                <field name="super" />
                <field name="sr" />
                <field name="sc" />
                <field name="time_extension" />
                <field name="holiday_start_time" />
                <field name="holiday_end_time" />
                <field name="alert_start_time" />
                <field name="extension_start_time" />
                <field name="status" />
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="journal_form_view">
        <field name="name">Journal Form View</field>
        <field name="model">shift.journal</field>
        <field name="arch" type="xml">
            <form>
                <header>
                    <button name="run" string="Run again for this day" type="object" />
                </header>
                <group>
                    <group>
                        <field name="date" />
                    </group>
                </group>
                <separator string="Assigned cooperator" />
                <field name="line_ids" readonly="1">
                    <tree>
                        <field name="cooperator_id" />
                    </tree>
                </field>
            </form>
        </field>
    </record>

    <!-- Actions -->
    <record model="ir.actions.act_window" id="action_coop_status">
        <field name="name">Cooperator Status</field>
        <field name="res_model">cooperative.status</field>
        <field name="view_mode">tree,form</field>
    </record>

    <record model="ir.actions.act_window" id="action_worker">
        <field name="name">Worker</field>
        <field name="res_model">res.partner</field>
        <field name="view_mode">kanban,tree,form</field>
        <field name="domain">[('is_worker', '=', True)]</field>
    </record>

    <record model="ir.actions.act_window" id="action_journal">
        <field name="name">Counter Journal</field>
        <field name="res_model">shift.journal</field>
        <field name="view_mode">tree,form</field>
    </record>
</odoo>
