appending times to dates when searching datetime doesn't take timezone into account
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned | |||
OpenERP Community Backports (Server) | Status tracked in 7.0 | |||||
6.1 |
Fix Committed
|
Low
|
Holger Brunn (Therp) | |||
7.0 |
In Progress
|
Low
|
Holger Brunn (Therp) |
Bug Description
In expression.py, the server appends ' 00:00:00' or ' 23:59:59' to dates if the field to be searched is of type datetime.
This gives confusing results for dates on day boundaries. Consider me searching
[('date', '<=', '2013-11-27')]
in timezone Europe/Amsterdam
which is rewritten in sql to
date <= '2013-11-27 23:59:59'
and a record with date 2013-11-27 23:30:00 UTC be found, even though it's 2013-11-28 00:30:00 CET.
So I think if we mess with the dates at all, we should convert the searched date from the user's timezone to UTC and search for the result or result+23:59:59.
I'll link a fix for ocb-server 6.1, but I'll be happy to provide merge requests for trunk and 7.0 proper if this is considered a bug.
Related branches
- Holger Brunn (Therp): Disapprove
- Ana Juaristi Olalde (community): Approve
-
Diff: 28 lines (+12/-3)1 file modifiedopenerp/osv/expression.py (+12/-3)
I would certainly consider it a bug and, living in Australia, would welcome any timezone quirk (read bug) fixes.
Thanks Holger,
Bill.