view_shift_leave.xml 4.56 KB
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
    @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
    License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
 -->
<odoo>

    <record id="view_shift_leave_search" model="ir.ui.view">
        <field name="model">shift.leave</field>
        <field name="arch" type="xml">
            <search>
                <field name="partner_id" />
                <field name="type_id" />
                <field name="duration" />
                <field name="state" />
            </search>
        </field>
    </record>

    <record id="view_shift_leave_calendar" model="ir.ui.view">
        <field name="model">shift.leave</field>
        <field name="arch" type="xml">
            <calendar date_start="start_date" date_stop="stop_date" color="type_id">
                <field name="name" />
                <field name="partner_id" />
                <field name="type_id" />
                <field name="start_date" />
                <field name="stop_date" />
                <field name="duration" />
                <field name="state" />
            </calendar>
        </field>
    </record>

    <record id="view_shift_leave_tree" model="ir.ui.view">
        <field name="model">shift.leave</field>
        <field name="arch" type="xml">
            <tree decoration-info="state == 'draft'" decoration-muted="state == 'cancel'">
                <field name="partner_id" />
                <field name="type_id" />
                <field name="start_date" />
                <field name="stop_date" />
                <field name="duration" />
                <field name="state" />
            </tree>
        </field>
    </record>

    <record id="view_shift_leave_form" model="ir.ui.view">
        <field name="model">shift.leave</field>
        <field name="arch" type="xml">
            <form>
                <header>
                    <field name="state" widget="statusbar" nolabel="1" readonly="1"/>
                    <button name="%(action_shift_leave_wizard)d" type="action" class="oe_highlight" string="Validate"
                        attrs="{'invisible': [('state', '!=', 'draft')]}"/>
                    <button name="button_cancel" type="object" string="Cancel"
                        attrs="{'invisible': [('state', '!=', 'done')]}"/>
                    <button name="button_draft" type="object" string="Set in a draft state"
                        attrs="{'invisible': [('state', '!=', 'cancel')]}"/>
                </header>
                <sheet>
                    <div class="oe_button_box" name="button_box" />
                    <div class="oe_title">
                        <h1>
                            <label for="name" class="oe_edit_only"/>
                            <field name="name" default_focus="1" />
                        </h1>
                    </div>
                    <group>
                        <group>
                            <field name="partner_id" options="{'no_create_edit': True, 'no_create': True, 'no_open': True }"/>
                            <field name="start_date"/>
                            <field name="duration" />
                        </group>
                        <group>
                            <field name="type_id" options="{'no_create_edit': True, 'no_create': True, 'no_open': True}"/>
                            <field name="stop_date" attrs="{'required': [('require_stop_date', '=', True)]}"/>
                            <field name="partner_state" />
                        </group>
                        <field name="require_stop_date" invisible="1"/>
                    </group>
                    <notebook colspan="4">
                        <page name="general" string="Other Leaves">
                            <group>
                                <field name="other_leave_ids" nolabel="1">
                                    <tree decoration-info="state == 'draft'" decoration-muted="state == 'cancel'">
                                        <field name="type_id" />
                                        <field name="start_date" />
                                        <field name="stop_date" />
                                        <field name="duration" />
                                        <field name="state" />
                                    </tree>
                                </field>
                            </group>
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>

</odoo>