Skip to content

Commit

Permalink
[IMP] show warning with user context
Browse files Browse the repository at this point in the history
The dates in the error message must be in the user's timezone
  • Loading branch information
dufresnedavid committed Sep 8, 2015
1 parent 1025c8b commit 8d63887
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions travel_journey/travel_journey.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,21 @@ def on_change_times(self, cr, uid, ids, departure, arrival,
return_trip=False, context=None):
if self._check_dep_arr_dates(departure, arrival):
return {}

context_timestamp = fields.datetime.context_timestamp

departure = context_timestamp(
cr, uid,
datetime.strptime(departure, DEFAULT_SERVER_DATETIME_FORMAT),
context=context
).strftime(DEFAULT_SERVER_DATETIME_FORMAT)

arrival = context_timestamp(
cr, uid,
datetime.strptime(arrival, DEFAULT_SERVER_DATETIME_FORMAT),
context=context
).strftime(DEFAULT_SERVER_DATETIME_FORMAT)

# Remove the return_arrival=False or return_arrival=False
# because we get the popup message two times.
# Anyway another control exists
Expand Down

0 comments on commit 8d63887

Please sign in to comment.