shift_template_view.xml 15.6 KB
Newer Older
François C. committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
<?xml version="1.0" encoding="utf-8"?>
<!-- ********************************************************************** -->
<!-- See __openerp__.py file for Copyright and Licence Informations.         -->
<!-- ********************************************************************** -->
<openerp>
    <data>
        <record id="action_create_shift_shifts" model="ir.actions.act_window">
            <field name="name">Create Shifts</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">create.shifts.wizard</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="target">new</field>
            <field name="view_id" ref="view_shift_template_wizard_form"/>
        </record>
        <record id="action_update_shifts" model="ir.actions.act_window">
            <field name="name">Update Shifts</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">update.shifts.wizard</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="target">new</field>
            <field name="view_id" ref="view_update_shifts_form"/>
        </record>

<!-- View : shift.template -->

        <record id="view_shift_template_calendar" model="ir.ui.view">
            <field name="model">shift.template</field>
            <field name="arch" type="xml">
            <calendar string="Templates"
                    date_start="start_datetime" date_stop="end_datetime"
                    color="shift_type_id" mode="week" quick_add="False">
                    <field name="name"/>
                    <field name="user_ids"/>
            </calendar>
            </field>
        </record>

        <record model="ir.ui.view" id="view_shift_template_tree">
            <field name="name">shift.template.tree</field>
            <field name="model">shift.template</field>
            <field name="arch" type="xml">
                <tree string="Templates">
                    <field name="name"/>
                    <field name="week_number"/>
                    <field name="week_list" invisible="1"/>
                    <field name="user_ids"/>
                    <field name="start_datetime"/>
                    <field name="end_datetime"/>
                    <field name="seats_min"/>
                    <field name="seats_availability" string="Seats Availability"/>
                    <field name="seats_max" attrs="{'invisible': [('seats_availability','=','unlimited')]}"/>
                    <field name="seats_available" />
                    <field name="last_shift_date"/>
                </tree>
            </field>
        </record>

        <record model="ir.ui.view" id="view_shift_template_search">
            <field name="name">shift.template.search</field>
            <field name="model">shift.template</field>
            <field name="arch" type="xml">
                <search string="Templates">
                    <field name="name" string="Template"/>
                    <field name="week_number"/>
                    <field name="shift_type_id"/>
                    <field name="user_ids"/>
                    <separator/>
                    <filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
                    <group expand="0" string="Group By">
                        <filter string="Shift Type" context="{'group_by':'shift_type_id'}"/>
                        <filter string="Week" context="{'group_by':'week_number'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="view_shift_template_form" model="ir.ui.view">
            <field name="model">shift.template</field>
            <field name="arch" type="xml">
                <form string="Shift Template">
                    <sheet>
                        <header>
                            <button name="%(coop_shift.action_create_shift_shifts)d" type="action" class="oe_highlight" icon="fa-cogs" string="Create shifts"/>
                        </header>
                        <div class="oe_button_box" name="button_box" groups="base.group_user">
                            <button name="toggle_active" type="object"
                                    class="oe_stat_button" icon="fa-archive">
                                <field name="active" widget="boolean_button"
                                    options='{"terminology": "archive"}'/>
                            </button>
                            <button name="%(coop_shift.act_template_registration_from_template)d"
                                type="action"
                                class="oe_stat_button oe_shift_attendee_button"
                                icon="fa-users"
                                help="Register with this template">
                                <field name="registration_qty" widget="statinfo" string="Attendees"/>
                            </button>
                            <button name="act_template_shift_from_template"
                                type="object"
                                class="oe_stat_button oe_shift_attendee_button"
                                icon="fa-calendar"
                                help="View Shifts">
                                <field name="shift_qty" widget="statinfo" string="Shifts"/>
                            </button>
                        </div>
                        <div class="oe_title">
                            <label for="name" class="oe_edit_only"/>
                            <h1><field name="name" placeholder="Template Name"/></h1>
                        </div>
                        <group attrs="{'invisible': [('updated_fields','=',False)]}">
                            <p class='alert alert-warning'> You have some changes on this template. You should consider <button type="action" name="%(coop_shift.action_update_shifts)d"  string="updating the linked shifts"  help="Click here to update some shifts linked to this template. " class="oe_link"/> or <button type="object" name="discard_changes" string="discarding the changes"  help="Click here if you don't want to repercute the template changes on the linked shifts. " class="oe_link"/> <br/>
                            </p>
                        </group>
                        <group name="main_field_group">
                            <group name="header">
                                <field name="updated_fields" invisible="1"/>
                                <field name="company_id" groups="base.group_multi_company"/>
                                <field name="address_id" context="{'show_address': 1}" options='{"always_reload": True}' invisible="0"  domain="['|',('id','=',company_id),'&amp;',('type','=','other'),('id','child_of',[company_id])]"/>
                                <field name="user_ids" options="{'no_create': True}" widget="many2many_tags"/>
                                <field name="week_number"/>
                                <field name="shift_type_id" options="{'no_create': True}" groups="coop_shift.group_shift_config"/>
                            </group>
                            <group name="datetime">
                                <field name="start_datetime"/>
                                <field name="end_datetime"/>
                                <field name="duration"/>
                            </group>
                        </group>
                        <notebook>
                            <page name="registrations" string="Registrations">
                                <group>
                                    <group>
                                        <field name="seats_min"/>
                                        <label for="seats_availability"/>
                                        <div>
                                            <field name="seats_availability" widget='radio'/>
                                            <span  attrs="{'invisible': [('seats_availability', '=', 'unlimited')]}" class="oe_read_only">
                                                to
                                            </span>
                                            <field name="seats_max" attrs="{'invisible': [('seats_availability', '=', 'unlimited')], 'required': [('seats_availability', '=', 'limited')]}"/>
                                        </div>
                                    </group>
                                </group>
                                <field name="shift_ticket_ids" context="{'default_name': name}">
                                    <tree string="Tickets" editable="bottom">
                                        <field name="name"/>
                                        <field name="product_id" context="{'shift_ok':1}" domain="[('shift_type_id','!=',False)]" options="{'no_create': True}"/>
                                        <field name="seats_max"/>
                                        <field name="seats_reserved" readonly="1"/>
                                        <field name="seats_available" readonly="1"/>
                                        <field name="seats_future" readonly="1"/>
                                    </tree>
                                </field>
                            </page>
                            <page string="Recurrence" groups="coop_shift.group_recurrency">
                                <group>
                                    <div>
                                        <group>
                                            <field name="recurrency"/>
                                        </group>
                                        <div attrs="{'invisible': [('recurrency', '=', False)]}">
                                            <group>
                                                <label for="interval"/>
                                                <div class="o_row">
                                                    <field name="interval" attrs="{'required': [('recurrency', '=', True)]}"/>
                                                    <field name="rrule_type" attrs="{'required': [('recurrency', '=', True)]}"/>
                                                </div>
                                                <label string="Until" for="end_type"/>
                                                <div class="o_row">
                                                    <field name="end_type" attrs="{'required': [('recurrency', '=', True)]}"/>
                                                    <field name="count" attrs="{'invisible': [('end_type', '!=', 'count')], 'required': [('recurrency', '=', True)]}"/>
                                                    <field name="final_date" attrs="{'invisible': [('end_type', '!=', 'end_date')], 'required': [('end_type', '=', 'end_date')]}"/>
                                                </div>
                                            </group>
                                            <group attrs="{'invisible': [('rrule_type', '!=', 'weekly')]}" name="weekdays">
                                                <field name="mo"/>
                                                <field name="tu"/>
                                                <field name="we"/>
                                                <field name="th"/>
                                                <field name="fr"/>
                                                <field name="sa"/>
                                                <field name="su"/>
                                            </group>
                                            <group attrs="{'invisible': [('rrule_type', '!=', 'monthly')]}">
                                                <label string="Day of Month" for="month_by"/>
                                                <div class="o_row">
                                                    <field name="month_by"/>
                                                    <field name="day"
                                                        attrs="{'required': [('month_by', '=', 'date'), ('rrule_type', '=', 'monthly')],
                                                                'invisible': [('month_by', '!=', 'date')]}"/>
                                                    <field name="byday" string="The"
                                                        attrs="{'required': [('month_by', '=', 'day'), ('rrule_type', '=', 'monthly')],
                                                                'invisible': [('month_by', '!=', 'day')]}"/>
                                                    <field name="week_list" nolabel="1"
                                                        attrs="{'required': [('month_by', '=', 'day'), ('rrule_type', '=', 'monthly')],
                                                                'invisible': [('month_by', '!=', 'day')]}"/>
                                                </div>
                                            </group>
                                        </div>
                                    </div>
                                    <group>
                                        <!-- <field name="rrule"/>  -->
                                        <!-- <field name="rrule" invisible="1"/>                                     -->
                                        <field name="recurrent_id" invisible="1" />
                                    </group>
                                </group>
                            </page>
                            <page string="Email Schedule" groups="event.group_email_scheduling">
                                <group>
                                    <field name="reply_to"/>
                                </group>
                                <field name="shift_mail_ids">
                                    <tree string="Email Schedule" editable="bottom">
                                        <field name="sequence" widget="handle"/>
                                        <field name="template_id" />
                                        <field name="interval_nbr" attrs="{'readonly':[('interval_unit','=','now')]}"/>
                                        <field name="interval_unit"/>
                                        <field name="interval_type"/>
                                    </tree>
                                </field>
                            </page>
                            <page name="technical_fields" string="Technicals">
                                <group>
                                    <field name="start_date"/>
                                    <field name="start_time"/>
                                    <field name="end_time"/>
                                </group>
                            </page>
                        </notebook>
                    </sheet>
                </form>
            </field>
        </record>
        <record id="action_shift_template" model="ir.actions.act_window">
            <field name="name">Shift Templates</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">shift.template</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,calendar,form</field>
            <field name="target">current</field>
            <field name="domain">[]</field>
        </record>
        <menuitem
            id="menu_shift_template"
            action="action_shift_template"
            name="Templates"
            parent="coop_shift.template_menu"
            groups="group_shift_manager"
            sequence="14"/>
    </data>
</openerp>