[FIX] domain parsing: better heuristic when a domain uses a date value for a datetime field

This comparison is flawed by nature but can be a useful
shortcut sometimes. It was using wrong boundaries and
would also loop for operators not explicitly handled
by the code (there was no `else` block). It is still
not possible to handle time zone conversions properly,
so this is only an experimental feature.

bzr revid: odo@openerp.com-20140404133827-5owdendpsr083a17
This commit is contained in:
Olivier Dony 2014-04-04 15:38:27 +02:00
parent 3b821e0854
commit 63b8fe0d33
1 changed files with 3 additions and 3 deletions

View File

@ -1012,10 +1012,10 @@ class expression(object):
else:
if field._type == 'datetime' and right and len(right) == 10:
if operator in ('>', '>=', '='):
right += ' 00:00:00'
elif operator in ('<', '<='):
if operator in ('>', '<='):
right += ' 23:59:59'
else:
right += ' 00:00:00'
push(create_substitution_leaf(leaf, (left, operator, right), working_model))
elif field.translate and right: