[MERGE]
[odoo/odoo.git] / addons / hr_holidays / hr_holidays.py
index 9d6328a..2e1fe79 100644 (file)
@@ -145,7 +145,7 @@ class hr_holidays(osv.osv):
     _sql_constraints = [
         ('type_value', "CHECK( (holiday_type='employee' AND employee_id IS NOT NULL) or (holiday_type='category' AND category_id IS NOT NULL))", "You have to select an employee or a category"),
         ('date_check', "CHECK ( number_of_days_temp > 0 )", "The number of days must be greater than 0 !"),
-        ('date_check2', "CHECK ( (type='add') OR (date_from < date_to))", "The start date must be before the end date !")
+        ('date_check2', "CHECK ( (type='add') OR (date_from <= date_to))", "The start date must be before the end date !")
     ]
 
     def _create_resource_leave(self, cr, uid, vals, context=None):
@@ -294,8 +294,8 @@ class hr_holidays(osv.osv):
 
             # If a category that created several holidays, cancel all related
             wf_service = netsvc.LocalService("workflow")
-            for id in record.linked_request_ids or []:
-                wf_service.trg_validate(uid, 'hr.holidays', id, 'cancel', cr)
+            for res in record.linked_request_ids:
+                wf_service.trg_validate(uid, 'hr.holidays', res.id, 'cancel', cr)
 
         return True