Merge lp:~andrei-levin/ocb-addons/6.1 into lp:ocb-addons/6.1

Proposed by Andrei Levin
Status: Needs review
Proposed branch: lp:~andrei-levin/ocb-addons/6.1
Merge into: lp:ocb-addons/6.1
Diff against target: 67 lines (+21/-4)
2 files modified
base_calendar/base_calendar.py (+20/-3)
base_calendar/wizard/base_calendar_invite_attendee.py (+1/-1)
To merge this branch: bzr merge lp:~andrei-levin/ocb-addons/6.1
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza code review Approve
Review via email: mp+222862@code.launchpad.net

Description of the change

Timestamps in body part of the meeting invitation email displays time in UTC and not in the user's timezone.

Steps to reproduce:
1) Set the timezone in user's preference,
2) Install CRM module and create a meeting and run `Invite People` wizard with `Send mail?` option marked.

You wont have any timezone information in invitation email contents.

This fix will consider timezone in User Preferences and will show timestamps with timezone information in email body.

The FIX is created by Ravi Gohil

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Andrei,

Thanks for bringing this module to 6.1.

Some little things to fix:

- Don't change module version. Although it could be convenient to reflect on module version the changes, neither OpenERP nor OCA do it usually. One of the reasons for OCA to not do that is that we are going to desynchronize versions numbers between official and OCB modules.
- Don't change .bzrignore.
- If original author id Ravi Gohil, you can credited him when you make the commit, adding argument --author and his e-mail, that you can get it querying with 'bzr log <ravi_branch> -r -1'.

Regards.

review: Needs Fixing (code review)
lp:~andrei-levin/ocb-addons/6.1 updated
6844. By Ravi Gohil (OpenERP) (rgo-openerp)

[FIX] base_calendar: Timestamps in body part of the meeting invitation email shows time in UTC. After application of this fix, timestamps will look like '2012-11-07 11:30:00 PM IST', which considers timezone from user preferences : (Maintenance Case : 581633)

Revision history for this message
Andrei Levin (andrei-levin) wrote :

Hi Pedro,

I hope it's OK now. I uncommitted and recommitted the code. If it
continue this way I'll become Bzr guru :-)

Regards

Andrei

2014-06-16 8:24 GMT+02:00 Pedro Manuel Baeza <email address hidden>:
> Review: Needs Fixing code review
>
> Hi, Andrei,
>
> Thanks for bringing this module to 6.1.
>
> Some little things to fix:
>
> - Don't change module version. Although it could be convenient to reflect on module version the changes, neither OpenERP nor OCA do it usually. One of the reasons for OCA to not do that is that we are going to desynchronize versions numbers between official and OCB modules.
> - Don't change .bzrignore.
> - If original author id Ravi Gohil, you can credited him when you make the commit, adding argument --author and his e-mail, that you can get it querying with 'bzr log <ravi_branch> -r -1'.
>
> Regards.
> --
> https://code.launchpad.net/~andrei-levin/ocb-addons/6.1/+merge/222862
> You are the owner of lp:~andrei-levin/ocb-addons/6.1.

--
Didotech Srl

Via T.Aspetti, 248
35133 Padova (PD)

Tel 049 8592286
Cell.: 347-2426694
www.didotech.com
www.simplerp.it

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Thank you very much for the changes. I have searched on another branches and his e-mail is: <email address hidden>, but we can put it on merge time, so don't worry more about it.

Regards.

review: Approve (code review)

Unmerged revisions

6844. By Ravi Gohil (OpenERP) (rgo-openerp)

[FIX] base_calendar: Timestamps in body part of the meeting invitation email shows time in UTC. After application of this fix, timestamps will look like '2012-11-07 11:30:00 PM IST', which considers timezone from user preferences : (Maintenance Case : 581633)

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 2013-09-10 15:12:35 +0000
3+++ base_calendar/base_calendar.py 2014-06-16 11:24:16 +0000
4@@ -208,6 +208,20 @@
5 </html>
6 """
7
8+def set_local_timezone(obj, cr, uid, dt, context=None):
9+ '''
10+ This method will convert datetime in logged in user's timezone
11+ dt: will be the datetime in string
12+ '''
13+ if len(dt) <= 10:
14+ return datetime.strptime(dt, '%Y-%m-%d')
15+ else:
16+ tz_info = context.get('tz') or 'UTC'
17+ local_tz = pytz.timezone(tz_info)
18+ local_time = tools.misc.server_to_local_timestamp(dt, '%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S', tz_info)
19+ event_date = local_tz.localize(datetime.strptime(local_time, '%Y-%m-%d %H:%M:%S'), is_dst=True)
20+ return event_date
21+
22 class calendar_attendee(osv.osv):
23 """
24 Calendar Attendee Information
25@@ -502,9 +516,11 @@
26 att_infos.append(((att2.user_id and att2.user_id.name) or \
27 (att2.partner_id and att2.partner_id.name) or \
28 att2.email) + ' - Status: ' + att2.state.title())
29+ start_date = set_local_timezone(self, cr, uid, res_obj.date, context=context).strftime('%Y-%m-%d %I:%M:%S %p %Z')
30+ end_date = res_obj.date_deadline and set_local_timezone(self, cr, uid, res_obj.date_deadline, context=context).strftime('%Y-%m-%d %I:%M:%S %p %Z') or False
31 body_vals = {'name': res_obj.name,
32- 'start_date': res_obj.date,
33- 'end_date': res_obj.date_deadline or False,
34+ 'start_date': start_date,
35+ 'end_date': end_date,
36 'description': res_obj.description or '-',
37 'location': res_obj.location or '-',
38 'attendees': '<br>'.join(att_infos),
39@@ -883,6 +899,7 @@
40
41 if alarm.action == 'email':
42 sub = '[Openobject Reminder] %s' % (alarm.name)
43+ event = set_local_timezone(self, cr, uid, alarm.event_date, context=context).strftime('%Y-%m-%d %I:%M:%S %p %Z')
44 body = """
45 Event: %s
46 Event Date: %s
47@@ -894,7 +911,7 @@
48 ----
49 %s
50
51-""" % (alarm.name, alarm.trigger_date, alarm.description, \
52+""" % (alarm.name, event, alarm.description, \
53 alarm.user_id.name, alarm.user_id.signature)
54 mail_to = [alarm.user_id.user_email]
55 for att in alarm.attendee_ids:
56
57=== modified file 'base_calendar/wizard/base_calendar_invite_attendee.py'
58--- base_calendar/wizard/base_calendar_invite_attendee.py 2012-01-31 13:36:57 +0000
59+++ base_calendar/wizard/base_calendar_invite_attendee.py 2014-06-16 11:24:16 +0000
60@@ -142,7 +142,7 @@
61 self._columns['type'].selection))
62 raise osv.except_osv(_('Error!'), _("%s must have an email address to send mail") %(name[0]))
63 att_obj._send_mail(cr, uid, attendees, mail_to, \
64- email_from = current_user.user_email or tools.config.get('email_from', False))
65+ email_from = current_user.user_email or tools.config.get('email_from', False), context=context)
66
67 return {'type': 'ir.actions.act_window_close'}
68

Subscribers

People subscribed via source and target branches