Tejas Tank (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-kanban-views2-hr-leaves-tta into 
lp:~openerp-dev/openobject-addons/trunk-kanban-views2.

Requested reviews:
  Amit (Open ERP) (apa-tiny)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-kanban-views2-hr-leaves-tta/+merge/77660

Hello,


Kanban view for hr leaves.


Thanks,
Tejas Tank
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-kanban-views2-hr-leaves-tta/+merge/77660
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-kanban-views2.
=== modified file 'hr_holidays/hr_holidays.py'
--- hr_holidays/hr_holidays.py	2011-09-22 06:14:19 +0000
+++ hr_holidays/hr_holidays.py	2011-09-30 07:39:27 +0000
@@ -92,7 +92,7 @@
 class hr_holidays(osv.osv):
     _name = "hr.holidays"
     _description = "Leave"
-    _order = "type desc, date_from asc"
+    _order = "priority, type desc, date_from asc"
 
     def _employee_get(self, cr, uid, context=None):
         ids = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context)
@@ -137,6 +137,15 @@
         'holiday_type': fields.selection([('employee','By Employee'),('category','By Employee Category')], 'Allocation Type', help='By Employee: Allocation/Request for individual Employee, By Employee Category: Allocation/Request for group of employees in category', required=True),
         'manager_id2': fields.many2one('hr.employee', 'Second Approval', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)'),
         'double_validation': fields.related('holiday_status_id', 'double_validation', type='boolean', relation='hr.holidays.status', string='Apply Double Validation'),
+        'email_from': fields.related('employee_id', 'work_email', string="Email", type="char", size=64),        
+        'color': fields.integer('Color'),
+        'priority': fields.selection([
+                        ('1', 'Highest'),
+                        ('2', 'High'),
+                        ('3', 'Normal'),
+                        ('4', 'Low'),
+                        ('5', 'Lowest'),
+                    ], 'Priority'),  
     }
     _defaults = {
         'employee_id': _employee_get,
@@ -151,6 +160,15 @@
         ('date_check', "CHECK ( number_of_days_temp >= 0 )", "The number of days must be greater than 0 !"),
     ]
 
+    def set_priority(self, cr, uid, ids, priority):
+        return self.write(cr, uid, ids, {'priority' : priority})
+  
+    def set_high_priority(self, cr, uid, ids, *args):
+        return self.set_priority(cr, uid, ids, '1')
+ 
+    def set_normal_priority(self, cr, uid, ids, *args):
+        return self.set_priority(cr, uid, ids, '3')
+
     def _create_resource_leave(self, cr, uid, vals, context=None):
         '''This method will create entry in resource calendar leave object at the time of holidays validated '''
         obj_res_leave = self.pool.get('resource.calendar.leaves')

=== modified file 'hr_holidays/hr_holidays_view.xml'
--- hr_holidays/hr_holidays_view.xml	2011-09-24 14:20:47 +0000
+++ hr_holidays/hr_holidays_view.xml	2011-09-30 07:39:27 +0000
@@ -218,8 +218,62 @@
                 </tree>
             </field>
         </record>
-
-
+               
+        <record model="ir.ui.view" id="kanban_hr_holodays">
+        <field name="name">hr.holidays.kanban</field>
+        <field name="model">hr.holidays</field>
+        <field name="type">kanban</field>
+        <field name="arch" type="xml">
+            <kanban default_group_by="state">
+                <templates>
+                    <t t-name="kanban-box">
+                        <t t-set="color" t-value="kanban_color(record.color.raw_value || record.state.raw_value)"/>
+                        <div t-att-class="color + (record.priority.raw_value == 1 ? ' oe_kanban_color_alert' : '')">
+                            <div class="oe_kanban_box oe_kanban_color_border">
+                                <table class="oe_kanban_table oe_kanban_box_header oe_kanban_color_bgdark oe_kanban_color_border oe_kanban_draghandle">
+                                <tr>
+                                    <td class="oe_kanban_title3" align="left" valign="middle">
+                                        <a t-if="record.priority.raw_value == 1" icon="star-on" type="object" name="set_normal_priority"/>
+                                        <a t-if="record.priority.raw_value != 1" icon="star-off" type="object" name="set_high_priority" style="opacity:0.6; filter:alpha(opacity=60);"/>
+                                        <field name="employee_id"/>
+                                    </td>                                    
+                                    <td valign="top" width="22"><img t-att-src="kanban_gravatar(record.email_from.value, 22)" class="oe_kanban_gravatar"/></td>
+                                </tr>
+                                </table>
+                                <div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_box_show_onclick_trigger">                                                                                
+                                    <span class="oe_kanban_title2"><field name="holiday_status_id"/></span><br/>                                    
+                                        <div style="padding:7px;">                                                
+                                                <label>Allocation Type :</label><field name="holiday_type"/>,<br/>                                                                                              
+                                                <label>Duration : </label><field name="date_from"/>  - <field name="date_to"/>,<br/>
+                                                <t t-if="record.department_id.raw_value"> Department : <i><field name="department_id"/></i>,<br/></t>                                         
+                                                <t t-if="record.manager_id.raw_value"> First Approval : <i><field name="manager_id"/></i>.<br/></t>
+                                                <t t-if="record.notes.raw_value"> Note : <i><field name="notes"/></i><br/></t>                                                
+                                                                                           
+                                        </div>
+                                </div>
+                                <div class="oe_kanban_buttons_set oe_kanban_color_border oe_kanban_color_bglight oe_kanban_box_show_onclick">
+                                    <div class="oe_kanban_left">
+                                        <a string="Edit" icon="gtk-edit" type="edit"/>
+                                        <a string="Delete" icon="gtk-close" type="delete"/>
+                                        <a string="Change Color" icon="color-picker" type="color" name="color"/>
+                                        <a string="Send New Email" name="%(mail.action_email_compose_message_wizard)d" icon="terp-mail-message-new" type="action"/>
+                                    </div>
+                                    <div class="oe_kanban_right">
+                                         <a string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes"/>
+                                        <a string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply"/>
+                                        <a string="Refuse" name="refuse" states="confirm,validate,draft" type="workflow" icon="gtk-no"/>
+                                        <a string="Set to Draft" name="set_to_draft" states="cancel" type="object" icon="gtk-convert"/>
+                                    </div>
+                                    <br class="oe_kanban_clear"/>
+                                </div>
+                            </div>
+                        </div>
+                        </t>
+                    </templates>
+                </kanban>
+            </field>
+        </record>
+        
         <record model="ir.ui.view" id="view_holiday">
             <field name="name">hr.holidays.tree</field>
             <field name="model">hr.holidays</field>
@@ -252,6 +306,7 @@
             <field name="name">Leave Requests</field>
             <field name="res_model">hr.holidays</field>
             <field name="view_type">form</field>
+            <field name="view_mode">tree,form,kanban</field>
             <field name="view_id" ref="edit_holiday_new"/>
             <field name="context">{"search_default_department_id": department_id, "search_default_my_leaves": 1}</field>
             <field name="domain">[('type','=','remove')]</field>
@@ -286,6 +341,7 @@
             <field name="name">Allocation Requests</field>
             <field name="res_model">hr.holidays</field>
             <field name="view_type">form</field>
+            <field name="view_mode">tree,form,kanban</field>
             <field name="context">{"search_default_my_leaves": 1,'default_type':'add',"search_default_department_id": department_id}</field>
             <field name="domain">[('type','=','add')]</field>
             <field name="view_id" ref="allocation_leave_new"/>
@@ -312,12 +368,26 @@
             <field name="name">Leaves Summary</field>
             <field name="res_model">hr.holidays</field>
             <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
+            <field name="view_mode">tree,form,kanban</field>
             <field name="view_id" eval="view_holiday_simple"/>
             <field name="context">{'search_default_my_leaves': 1, 'search_default_group_type': 1}</field>
             <field name="domain">[('holiday_type','=','employee')]</field>
             <field name="search_view_id" ref="view_hr_holidays_filter"/>
         </record>
+        
+        <record model="ir.actions.act_window.view" id="open_company_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="open_company_allocation"/>
+        </record>
+
+        <record model="ir.actions.act_window.view" id="open_company_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="open_company_allocation"/>
+        </record>        
 
         <menuitem name="Leaves Summary" parent="menu_open_ask_holidays" id="menu_open_company_allocation" action="open_company_allocation" sequence="40"/>
 

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to