~openerp-dev/openobject-server/saas-3-bug_1291322-ptr

« back to all changes in this revision

Viewing changes to openerp/osv/expression.py

  • Committer: Olivier Dony
  • Date: 2014-04-04 13:38:27 UTC
  • Revision ID: odo@openerp.com-20140404133827-5owdendpsr083a17
[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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1012
1012
 
1013
1013
            else:
1014
1014
                if field._type == 'datetime' and right and len(right) == 10:
1015
 
                    if operator in ('>', '>=', '='):
 
1015
                    if operator in ('>', '<='):
 
1016
                        right += ' 23:59:59'
 
1017
                    else:
1016
1018
                        right += ' 00:00:00'
1017
 
                    elif operator in ('<', '<='):
1018
 
                        right += ' 23:59:59'
1019
1019
                    push(create_substitution_leaf(leaf, (left, operator, right), working_model))
1020
1020
 
1021
1021
                elif field.translate and right: