_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):
# 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