[FIX] hr_holidays: leave holiday overlap should ignore cancelled/refused ones

Obviously a cancelled leave does not really
overlap with a new one.

bzr revid: odo@openerp.com-20131023162928-56vdsjxr8sa4n3jv

Closes #2329
This commit is contained in:
Olivier Dony 2013-10-23 18:29:28 +02:00 committed by Denis Ledoux
parent 2c37f83435
commit dc0e126b53
1 changed files with 3 additions and 1 deletions

View File

@ -141,7 +141,9 @@ class hr_holidays(osv.osv):
def _check_date(self, cr, uid, ids):
for holiday in self.browse(cr, uid, ids):
holiday_ids = self.search(cr, uid, [('date_from', '<=', holiday.date_to), ('date_to', '>=', holiday.date_from), ('employee_id', '=', holiday.employee_id.id), ('id', '<>', holiday.id)])
holiday_ids = self.search(cr, uid, [('date_from', '<=', holiday.date_to), ('date_to', '>=', holiday.date_from),
('employee_id', '=', holiday.employee_id.id), ('id', '<>', holiday.id),
('state', 'not in', ['cancel', 'refuse'])])
if holiday_ids:
return False
return True