[MERGE] addons 16 survey
[odoo/odoo.git] / addons / hr_holidays / hr_holidays_view.xml
index c975fb4..e92679e 100644 (file)
@@ -8,7 +8,7 @@
             <field name="type">ir.actions.server</field>
             <field name="model_id" ref="model_hr_holidays"/>
             <field name="state">code</field>
-            <field name="code">self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context)</field>
+            <field name="code">self.message_mark_as_unread(cr, uid, context.get('active_ids'), context=context)</field>
         </record>
         <record id="action_holidays_unread" model="ir.values">
             <field name="name">action_holidays_unread</field>
@@ -26,7 +26,7 @@
             <field name="type">ir.actions.server</field>
             <field name="model_id" ref="model_hr_holidays"/>
             <field name="state">code</field>
-            <field name="code">self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context)</field>
+            <field name="code">self.message_mark_as_read(cr, uid, context.get('active_ids'), context=context)</field>
         </record>
         <record id="action_holidays_read" model="ir.values">
             <field name="name">action_holidays_read</field>
             <field name="arch" type="xml">
                 <search string="Search Leave">
                     <field name="date_from"/>
-                    <filter icon="terp-mail-message-new" string="Inbox" help="Unread messages" name="needaction_pending" domain="[('needaction_pending','=',True)]"/>
                     <separator/>
                     <filter icon="terp-check" domain="[('state','=','draft')]" string="To Confirm"/>
-                    <filter icon="terp-camera_test" domain="[('state','=','confirm')]" string="To Approve" name="approve"/>
+                    <filter icon="terp-camera_test" domain="[('state','in',('confirm','validate1'))]" string="To Approve" name="approve"/>
                     <filter icon="terp-camera_test" domain="[('state','=','validate')]" string="Validated" name="validated"/>
                     <separator/>
                     <filter icon="terp-go-year" name="year" string="Year" domain="[('holiday_status_id.active','=',True)]" help="Filters only on allocations and requests that belong to an holiday type that is 'active' (active field is True)"/>
@@ -93,7 +92,7 @@
                 <header>
                     <button string="Approve" name="validate" states="confirm" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
                     <button string="Validate" name="second_validate" states="validate1" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
-                    <button string="Refuse" name="refuse" states="confirm,validate1,validate" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
+                    <button string="Refuse" name="refuse" states="confirm,validate1,validate" type="workflow" groups="base.group_hr_user"/>
                     <button string="Reset to New" name="set_to_draft" states="refuse" type="object" groups="base.group_hr_user" />
                     <field name="state" widget="statusbar" statusbar_visible="draft,confirm,validate" statusbar_colors='{"confirm":"blue","validate1":"blue","refuse":"red"}'/>
                 </header>
                     <group>
                         <group>
                             <field name="name" attrs="{'readonly':[('state','!=','draft'),('state','!=','confirm')]}"/>
-                            <field name="holiday_status_id" on_change="onchange_status_id(holiday_status_id)" context="{'employee_id':employee_id}"/>
+                            <field name="holiday_status_id" context="{'employee_id':employee_id}"/>
                             <label for="number_of_days_temp" string="Duration"/>
                             <div>
                                 <group col="3">
                     </group>
                 </sheet>
                 <div class="oe_chatter">
-                    <field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
                     <field name="message_follower_ids" widget="mail_followers"/>
+                    <field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
                 </div>
                 </form>
             </field>
                 <header>
                     <button string="Approve" name="validate" states="confirm" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
                     <button string="Validate" name="second_validate" states="validate1" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
-                    <button string="Refuse" name="refuse" states="confirm,validate,validate1" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
+                    <button string="Refuse" name="refuse" states="confirm,validate,validate1" type="workflow" groups="base.group_hr_user"/>
                     <button string="Reset to New" name="set_to_draft" states="cancel,refuse" type="object" groups="base.group_hr_user" />
                     <field name="state" widget="statusbar" statusbar_visible="draft,confirm,validate" statusbar_colors='{"confirm":"blue","validate1":"blue","refuse":"red"}'/>
                 </header>
                     <group>
                         <group>
                             <field name="name" required="1" attrs="{'readonly':[('state','!=','draft'),('state','!=','confirm')]}"/>
-                            <field name="holiday_status_id" on_change="onchange_status_id(holiday_status_id)" context="{'employee_id':employee_id}"/>
+                            <field name="holiday_status_id" context="{'employee_id':employee_id}"/>
                             <field name="number_of_days_temp"/>
                         </group>
                         <group>
                     <field name="notes" nolabel="1" colspan="4" placeholder="Add a reason..."/>
                 </sheet>
                 <div class="oe_chatter">
-                    <field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
                     <field name="message_follower_ids" widget="mail_followers"/>
+                    <field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
                 </div>
                 </form>
             </field>
             <field name="name">hr.holidays.allocation.tree</field>
             <field name="model">hr.holidays</field>
             <field name="arch" type="xml">
-                <tree fonts="bold:needaction_pending==True" colors="red:state == 'refuse';blue:state == 'draft';black:state in ('confirm','validate','validate1')" string="Allocation Requests">
-                    <field name="needaction_pending" invisible="1"/>
+                <tree colors="red:state == 'refuse';blue:state == 'draft';black:state in ('confirm','validate','validate1')" string="Allocation Requests">
                     <field name="employee_id"/>
                     <field name="holiday_type"/>
                     <field name="category_id"/>
             <field name="model">hr.holidays</field>
             <field name="priority">20</field>
             <field name="arch" type="xml">
-                <tree fonts="bold:needaction_pending==True" colors="red:state == 'refuse';blue:state == ' draft';black:state in ('confirm','validate','validate1')" string="Leaves Summary">
-                    <field name="needaction_pending" invisible="1"/>
+                <tree colors="red:state == 'refuse';blue:state == ' draft';black:state in ('confirm','validate','validate1')" string="Leaves Summary">
                     <field name="employee_id"/>
                     <field name="category_id" invisible="1"/>
                     <field name="department_id" invisible="1"/>
             <field name="name">hr.holidays.tree</field>
             <field name="model">hr.holidays</field>
             <field name="arch" type="xml">
-                <tree fonts="bold:needaction_pending==True" colors="red:state == 'refuse';blue:state == ' draft';black:state in ('confirm','validate','validate1')" string="Leave Requests">
-                    <field name="needaction_pending" invisible="1"/>
+                <tree colors="red:state == 'refuse';blue:state == ' draft';black:state in ('confirm','validate','validate1')" string="Leave Requests">
                     <field name="employee_id"/>
                     <field name="holiday_type" string="Mode" groups="base.group_hr_user"/>
                     <field name="name"/>
         <menuitem name="Leaves" parent="hr.menu_hr_root" id="menu_open_ask_holidays" sequence="20"/>
 
         <record model="ir.actions.act_window" id="open_ask_holidays">
-            <field name="name">Leave Requests</field>
+            <field name="name">My Leave Requests</field>
             <field name="res_model">hr.holidays</field>
             <field name="view_type">form</field>
             <field name="view_id" ref="edit_holiday_new"/>
         <menuitem name="Leave Requests to Approve" parent="menu_open_ask_holidays" id="menu_request_approve_holidays" action="request_approve_holidays" groups="base.group_hr_user"/>
 
         <record model="ir.actions.act_window" id="open_allocation_holidays">
-            <field name="name">Allocation Requests</field>
+            <field name="name">My Allocation Requests</field>
             <field name="res_model">hr.holidays</field>
             <field name="view_type">form</field>
             <field name="context">{'default_type':'add'}</field>
-            <field name="domain">[('type','=','add')]</field>
+            <field name="domain">[('type','=','add'),('employee_id.user_id','=', uid)]</field>
             <field name="view_id" ref="allocation_leave_new"/>
             <field name="search_view_id" ref="view_hr_holidays_filter"/>
         </record>
             <field name="act_window_id" ref="open_allocation_holidays"/>
         </record>
 
-        <menuitem name="Allocation Requests" parent="menu_open_ask_holidays" id="menu_open_allocation_holidays" action="open_allocation_holidays"/>
+        <menuitem name="My Allocation Requests" parent="menu_open_ask_holidays" id="menu_open_allocation_holidays" action="open_allocation_holidays"/>
+
+        <record model="ir.actions.act_window" id="request_approve_allocation">
+            <field name="name">Allocation Requests to Approve</field>
+            <field name="res_model">hr.holidays</field>
+            <field name="view_type">form</field>
+            <field name="context">{'default_type': 'add', 'search_default_approve':1}</field>
+            <field name="domain">[('type','=','add')]</field>
+            <field name="view_id" ref="allocation_leave_new"/>
+            <field name="search_view_id" ref="view_hr_holidays_filter"/>
+        </record>
+
+        <record model="ir.actions.act_window.view" id="action_request_approve_allocation_tree">
+            <field name="sequence" eval="1"/>
+            <field name="view_mode">tree</field>
+            <field name="view_id" ref="view_holiday_allocation_tree"/>
+            <field name="act_window_id" ref="request_approve_allocation"/>
+        </record>
+
+        <record model="ir.actions.act_window.view" id="action_request_approve_allocation_form">
+            <field name="sequence" eval="2"/>
+            <field name="view_mode">form</field>
+            <field name="view_id" ref="allocation_leave_new"/>
+            <field name="act_window_id" ref="request_approve_allocation"/>
+        </record>
+
+        <menuitem parent="menu_open_ask_holidays" id="menu_request_approve_allocation" action="request_approve_allocation" groups="base.group_hr_manager"/>
 
         <record model="ir.actions.act_window" id="open_company_allocation">
             <field name="name">Leaves Summary</field>
         <record id="hr_holidays_leaves_assign_tree_view" model="ir.ui.view">
             <field name="name">hr.employee.leave.tree</field>
             <field name="model">hr.employee</field>
+            <field name="priority" eval="20"/>
             <field name="arch" type="xml">
                 <tree string="Assign Leaves" editable="bottom">
                     <field name="name" string="Employee"/>
             <field name="model">hr.employee</field>
             <field name="inherit_id" ref="hr.view_employee_form"/>
             <field name="arch" type="xml">
-                <field name="active" position="before">
-                    <label for="remaining_leaves"/>
-                    <div>
-                        <field name="remaining_leaves" class="oe_inline"/>
-                        <button name="%(act_hr_employee_holiday_request)d" string="Leaves" type="action" class="oe_inline oe_right"/>
-                    </div>
-                </field>
+                <xpath expr="//group[@name='active_group']" position="before">
+                    <group string="Leaves">
+                        <label for="remaining_leaves"/>
+                        <div>
+                            <field name="remaining_leaves" class="oe_inline"/>
+                        </div>
+                    </group>
+                </xpath>
+                <xpath expr="//div[@name='button_box']" position="inside">
+                    <button name="%(act_hr_employee_holiday_request)d" string="Leaves" type="action" groups="base.group_hr_user"/>
+                </xpath>
             </field>
         </record>