[FIX] sql expression: in search, add the time part to datetime field when it's not present

bzr revid: olt@tinyerp.com-20090724093650-ml4nc7vgfepq9wos
This commit is contained in:
Olivier Laurent 2009-07-24 11:36:50 +02:00
parent 0a507f6edf
commit c639abd97e
1 changed files with 10 additions and 2 deletions

View File

@ -198,6 +198,14 @@ class expression(object):
self.__exp[i] = (left, 'in', right)
else:
# other field type
# add the time part to datetime field when it's not there:
if field._type == 'datetime' and len(self.__exp[i][2]) == 10:
if operator in ('>', '>='):
self.__exp[i][2] += ' 00:00:00'
elif operator in ('<', '<='):
self.__exp[i][2] += ' 23:59:59'
if field.translate:
if operator in ('like', 'ilike', 'not like', 'not ilike'):
right = '%%%s%%' % right