Merge lp:~therp-nl/ocb-server/6.1-lp1255612 into lp:ocb-server/6.1

Proposed by Holger Brunn (Therp)
Status: Rejected
Rejected by: Holger Brunn (Therp)
Proposed branch: lp:~therp-nl/ocb-server/6.1-lp1255612
Merge into: lp:ocb-server/6.1
Diff against target: 28 lines (+12/-3)
1 file modified
openerp/osv/expression.py (+12/-3)
To merge this branch: bzr merge lp:~therp-nl/ocb-server/6.1-lp1255612
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) Disapprove
Ana Juaristi Olalde (community) Approve
Review via email: mp+196958@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ana Juaristi Olalde (ajuaristio) wrote :

Why not? Much more generic than hardcoding time format.

Just code reviewd, not tested.

review: Approve
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :
review: Disapprove

Unmerged revisions

4322. By Holger Brunn (Therp)

[FIX] take context timezone into account when converting dates to
datetime

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openerp/osv/expression.py'
--- openerp/osv/expression.py 2012-01-24 12:42:52 +0000
+++ openerp/osv/expression.py 2013-11-27 18:05:36 +0000
@@ -606,13 +606,22 @@
606 # other field type606 # other field type
607 # add the time part to datetime field when it's not there:607 # add the time part to datetime field when it's not there:
608 if field._type == 'datetime' and self.__exp[i][2] and len(self.__exp[i][2]) == 10:608 if field._type == 'datetime' and self.__exp[i][2] and len(self.__exp[i][2]) == 10:
609
610 self.__exp[i] = list(self.__exp[i])609 self.__exp[i] = list(self.__exp[i])
611610
611 from openerp.osv import fields
612 from openerp.tools.misc import DEFAULT_SERVER_DATE_FORMAT,\
613 DEFAULT_SERVER_DATETIME_FORMAT
614 date = fields.datetime.context_timestamp(
615 cr, uid, datetime.datetime.strptime(
616 self.__exp[i][2], DEFAULT_SERVER_DATE_FORMAT))
617
612 if operator in ('>', '>='):618 if operator in ('>', '>='):
613 self.__exp[i][2] += ' 00:00:00'619 self.__exp[i][2] = date.strftime(
620 DEFAULT_SERVER_DATETIME_FORMAT)
614 elif operator in ('<', '<='):621 elif operator in ('<', '<='):
615 self.__exp[i][2] += ' 23:59:59'622 self.__exp[i][2] = (date + datetime.timedelta(
623 hours=23, minutes=59, seconds=59)).strftime(
624 DEFAULT_SERVER_DATETIME_FORMAT)
616625
617 self.__exp[i] = tuple(self.__exp[i])626 self.__exp[i] = tuple(self.__exp[i])
618627

Subscribers

People subscribed via source and target branches

to status/vote changes: