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
=== modified file 'base_calendar/base_calendar.py'
--- base_calendar/base_calendar.py 2013-09-10 15:12:35 +0000
+++ base_calendar/base_calendar.py 2014-06-16 11:24:16 +0000
@@ -208,6 +208,20 @@
208</html>208</html>
209"""209"""
210210
211def set_local_timezone(obj, cr, uid, dt, context=None):
212 '''
213 This method will convert datetime in logged in user's timezone
214 dt: will be the datetime in string
215 '''
216 if len(dt) <= 10:
217 return datetime.strptime(dt, '%Y-%m-%d')
218 else:
219 tz_info = context.get('tz') or 'UTC'
220 local_tz = pytz.timezone(tz_info)
221 local_time = tools.misc.server_to_local_timestamp(dt, '%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S', tz_info)
222 event_date = local_tz.localize(datetime.strptime(local_time, '%Y-%m-%d %H:%M:%S'), is_dst=True)
223 return event_date
224
211class calendar_attendee(osv.osv):225class calendar_attendee(osv.osv):
212 """226 """
213 Calendar Attendee Information227 Calendar Attendee Information
@@ -502,9 +516,11 @@
502 att_infos.append(((att2.user_id and att2.user_id.name) or \516 att_infos.append(((att2.user_id and att2.user_id.name) or \
503 (att2.partner_id and att2.partner_id.name) or \517 (att2.partner_id and att2.partner_id.name) or \
504 att2.email) + ' - Status: ' + att2.state.title())518 att2.email) + ' - Status: ' + att2.state.title())
519 start_date = set_local_timezone(self, cr, uid, res_obj.date, context=context).strftime('%Y-%m-%d %I:%M:%S %p %Z')
520 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
505 body_vals = {'name': res_obj.name,521 body_vals = {'name': res_obj.name,
506 'start_date': res_obj.date,522 'start_date': start_date,
507 'end_date': res_obj.date_deadline or False,523 'end_date': end_date,
508 'description': res_obj.description or '-',524 'description': res_obj.description or '-',
509 'location': res_obj.location or '-',525 'location': res_obj.location or '-',
510 'attendees': '<br>'.join(att_infos),526 'attendees': '<br>'.join(att_infos),
@@ -883,6 +899,7 @@
883899
884 if alarm.action == 'email':900 if alarm.action == 'email':
885 sub = '[Openobject Reminder] %s' % (alarm.name)901 sub = '[Openobject Reminder] %s' % (alarm.name)
902 event = set_local_timezone(self, cr, uid, alarm.event_date, context=context).strftime('%Y-%m-%d %I:%M:%S %p %Z')
886 body = """903 body = """
887Event: %s904Event: %s
888Event Date: %s905Event Date: %s
@@ -894,7 +911,7 @@
894----911----
895%s912%s
896913
897""" % (alarm.name, alarm.trigger_date, alarm.description, \914""" % (alarm.name, event, alarm.description, \
898 alarm.user_id.name, alarm.user_id.signature)915 alarm.user_id.name, alarm.user_id.signature)
899 mail_to = [alarm.user_id.user_email]916 mail_to = [alarm.user_id.user_email]
900 for att in alarm.attendee_ids:917 for att in alarm.attendee_ids:
901918
=== modified file 'base_calendar/wizard/base_calendar_invite_attendee.py'
--- base_calendar/wizard/base_calendar_invite_attendee.py 2012-01-31 13:36:57 +0000
+++ base_calendar/wizard/base_calendar_invite_attendee.py 2014-06-16 11:24:16 +0000
@@ -142,7 +142,7 @@
142 self._columns['type'].selection))142 self._columns['type'].selection))
143 raise osv.except_osv(_('Error!'), _("%s must have an email address to send mail") %(name[0]))143 raise osv.except_osv(_('Error!'), _("%s must have an email address to send mail") %(name[0]))
144 att_obj._send_mail(cr, uid, attendees, mail_to, \144 att_obj._send_mail(cr, uid, attendees, mail_to, \
145 email_from = current_user.user_email or tools.config.get('email_from', False))145 email_from = current_user.user_email or tools.config.get('email_from', False), context=context)
146146
147 return {'type': 'ir.actions.act_window_close'}147 return {'type': 'ir.actions.act_window_close'}
148148

Subscribers

People subscribed via source and target branches