Merge lp:~openerp-dev/openobject-addons/6.1-opw-579812-rgo into lp:openobject-addons/6.1

Proposed by Ravi Gohil (OpenERP)
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 7027
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-579812-rgo
Merge into: lp:openobject-addons/6.1
Diff against target: 70 lines (+20/-13)
1 file modified
base_calendar/base_calendar.py (+20/-13)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-579812-rgo
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+128489@code.launchpad.net

Description of the change

Hello,

This MP contains fix for below issues:

When you create a meeting for all day, time in start date and end date are not set to 00:00:00 or to 12:00:00 AM.

Currently, when the mail is sent by the event reminder scheduler, `Event Date` is set to alarm's trigger date instead of actual event date.

When synchronizing the invitation.ics file with calendar client, the calendar client shows meeting datetime as it received, that is in UTC, meeting datetime should be converted to local timezone.

Kindly review the fix.

Thanks.

To post a comment you must log in.
7018. By Xavier ALT

[MERGE] OPW 577045: translations: collective fix of missing translation terms in reports

7019. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7020. By Xavier ALT

[MERGE] OPW 575716: account: force account.financial.report balance of *zero* to be displayed positively

7021. By Xavier ALT

[MERGE] OPW 579553: account: fix traceback when modifing existing journal entry line

7022. By Xavier ALT

[MERGE] OPW 576019: sale/purchase: when changing SO or PO line product, use product's UoM even if current UoM is of the same category

7023. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7024. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7025. By Stephane Wirtel (OpenERP)

[FIX] point_of_sale: remove unused file

7026. By Xavier ALT

[MERGE] OPW 578622: project: duplicating project must reset analytic account code

7027. By Ravi Gohil (OpenERP)

[FIX] base_calendar: Synchronizing the invitation.ics file with calendar client shows meeting time in UTC : (Maintenance Case : 579812)

Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello,

This bug was qualified as Confirmed(partially) on Trunk (means still existing and reproducible). A Merge Proposal for trunk was created to fix it. Here is the link to follow the MP on Launchpad and be informed once it's been merged in trunk: ... If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Thanks,
Naresh Soni

Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Unmerged revisions

7027. By Ravi Gohil (OpenERP)

[FIX] base_calendar: Synchronizing the invitation.ics file with calendar client shows meeting time in UTC : (Maintenance Case : 579812)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'base_calendar/base_calendar.py'
2--- base_calendar/base_calendar.py 2012-03-05 14:35:54 +0000
3+++ base_calendar/base_calendar.py 2012-10-11 09:58:22 +0000
4@@ -399,11 +399,12 @@
5 @return: .ics file content
6 """
7 res = None
8- def ics_datetime(idate, short=False):
9+ def ics_datetime(idate, short=False, dtfield=False):
10 if idate:
11 if short or len(idate)<=10:
12 return date.fromtimestamp(time.mktime(time.strptime(idate, '%Y-%m-%d')))
13 else:
14+ dtfield.params['TZID'] = ['UTC']
15 return datetime.strptime(idate, '%Y-%m-%d %H:%M:%S')
16 else:
17 return False
18@@ -416,9 +417,12 @@
19 event = cal.add('vevent')
20 if not event_obj.date_deadline or not event_obj.date:
21 raise osv.except_osv(_('Warning !'),_("Couldn't Invite because date is not specified!"))
22- event.add('created').value = ics_datetime(time.strftime('%Y-%m-%d %H:%M:%S'))
23- event.add('dtstart').value = ics_datetime(event_obj.date)
24- event.add('dtend').value = ics_datetime(event_obj.date_deadline)
25+ dtfield = event.add('created')
26+ dtfield.value = ics_datetime(time.strftime('%Y-%m-%d %H:%M:%S'), dtfield=dtfield)
27+ dtfield = event.add('dtstart')
28+ dtfield.value = ics_datetime(event_obj.date, dtfield=dtfield)
29+ dtfield = event.add('dtend')
30+ dtfield.value = ics_datetime(event_obj.date_deadline, dtfield=dtfield)
31 event.add('summary').value = event_obj.name
32 if event_obj.description:
33 event.add('description').value = event_obj.description
34@@ -890,7 +894,7 @@
35 ----
36 %s
37
38-""" % (alarm.name, alarm.trigger_date, alarm.description, \
39+""" % (alarm.name, alarm.event_date, alarm.description, \
40 alarm.user_id.name, alarm.user_id.signature)
41 mail_to = [alarm.user_id.user_email]
42 for att in alarm.attendee_ids:
43@@ -942,16 +946,19 @@
44 duration = 1.00
45 value['duration'] = duration
46
47+ start = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S")
48 if allday: # For all day event
49- value = {'duration': 24.0}
50 duration = 24.0
51- if start_date:
52- start = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S")
53- start_date = datetime.strftime(datetime(start.year, start.month, start.day, 0,0,0), "%Y-%m-%d %H:%M:%S")
54- value['date'] = start_date
55-
56-
57- start = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S")
58+ value['duration'] = duration
59+ # change start_date's time to 00:00:00 in the user's timezone
60+ user = self.pool.get('res.users').browse(cr, uid, uid)
61+ tz = pytz.timezone(user.context_tz) if user.context_tz else pytz.utc
62+ start = pytz.utc.localize(start).astimezone(tz) # convert start in user's timezone
63+ start = start.replace(hour=0, minute=0, second=0) # change start's time to 00:00:00
64+ start = start.astimezone(pytz.utc) # convert start back to utc
65+ start_date = start.strftime("%Y-%m-%d %H:%M:%S")
66+ value['date'] = start_date
67+
68 if end_date and not duration:
69 end = datetime.strptime(end_date, "%Y-%m-%d %H:%M:%S")
70 diff = end - start