From 63b8fe0d337b52a95fc20e99fc06cb862669520e Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 4 Apr 2014 15:38:27 +0200 Subject: [PATCH] [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 --- openerp/osv/expression.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openerp/osv/expression.py b/openerp/osv/expression.py index c01f4c96ba2..70a28413aeb 100644 --- a/openerp/osv/expression.py +++ b/openerp/osv/expression.py @@ -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: