[FIX] hr_holidays: fix domain in determination of employee leave status
authorRaphael Collet <rco@openerp.com>
Fri, 23 Dec 2011 09:02:10 +0000 (10:02 +0100)
committerRaphael Collet <rco@openerp.com>
Fri, 23 Dec 2011 09:02:10 +0000 (10:02 +0100)
bzr revid: rco@openerp.com-20111223090210-v9rmu26fa3mfklp6

addons/hr_holidays/hr_holidays.py

index 34f30e9..58f3dd8 100644 (file)
@@ -399,13 +399,13 @@ class hr_employee(osv.osv):
    def _get_leave_status(self, cr, uid, ids, name, args, context=None):
         holidays_id = self.pool.get('hr.holidays').search(cr, uid, 
            [('employee_id', 'in', ids), ('date_from','<=',time.strftime('%Y-%m-%d %H:%M:%S')), 
-            ('date_to','>=',time.strftime('%Y-%m-%d %H:%M:%S')),('type','=','remove')],
+            ('date_to','>=',time.strftime('%Y-%m-%d %H:%M:%S')),('type','=','remove'),('state','not in',('cancel','refuse'))],
            context=context)
         result = {}
         for id in ids:
             result[id] = {
                 'current_leave_state': False,
-                'current_leave_id': False
+                'current_leave_id': False,
             }
         for holiday in self.pool.get('hr.holidays').browse(cr, uid, holidays_id, context=context):
             result[holiday.employee_id.id]['current_leave_state'] = holiday.state