[FIX] hr : hr_timesheet_sheet's can overlap by one day

lp bug: https://launchpad.net/bugs/887553 fixed

bzr revid: bde@tinyerp.com-20111109062543-6s5yi9zn0lfss907
This commit is contained in:
Stéphane Bidoul
2011-11-09 11:55:43 +05:30
committed by Bharat (OpenERP)
parent 80257ecb89
commit 6eabac46a9
@@ -313,7 +313,7 @@ class hr_timesheet_sheet(osv.osv):
def _default_employee(self, cr, uid, context=None):
emp_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)], context=context)
return emp_ids and emp_ids[0] or False
_defaults = {
'date_from' : _default_date_from,
'date_current' : lambda *a: time.strftime('%Y-%m-%d'),
@@ -329,7 +329,7 @@ class hr_timesheet_sheet(osv.osv):
if new_user_id:
cr.execute('SELECT id \
FROM hr_timesheet_sheet_sheet \
WHERE (date_from < %s and %s < date_to) \
WHERE (date_from <= %s and %s <= date_to) \
AND user_id=%s \
AND id <> %s',(sheet.date_to, sheet.date_from, new_user_id, sheet.id))
if cr.fetchall():