diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index 297fc68be58..ab0d8d324b4 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -142,7 +142,7 @@ html_invitation = """
You are invited for %(company)s Event. |
- Below are the details of event: |
+ Below are the details of event. Hours and dates expressed in %(timezone)s time. |
@@ -427,12 +427,9 @@ property or property parameter."),
res = None
def ics_datetime(idate, short=False):
if idate:
- if short or len(idate)<=10:
- return date.fromtimestamp(time.mktime(time.strptime(idate, '%Y-%m-%d')))
- else:
- return datetime.strptime(idate, '%Y-%m-%d %H:%M:%S')
- else:
- return False
+ #returns the datetime as UTC, because it is stored as it in the database
+ return datetime.strptime(idate, '%Y-%m-%d %H:%M:%S').replace(tzinfo=pytz.timezone('UTC'))
+ return False
try:
# FIXME: why isn't this in CalDAV?
import vobject
@@ -516,9 +513,17 @@ property or property parameter."),
att_infos.append(((att2.user_id and att2.user_id.name) or \
(att2.partner_id and att2.partner_id.name) or \
att2.email) + ' - Status: ' + att2.state.title())
+ #dates and times are gonna be expressed in `tz` time (local timezone of the `uid`)
+ tz = context.get('tz', pytz.timezone('UTC'))
+ #res_obj.date and res_obj.date_deadline are in UTC in database so we use context_timestamp() to transform them in the `tz` timezone
+ date_start = fields.datetime.context_timestamp(cr, uid, datetime.strptime(res_obj.date, tools.DEFAULT_SERVER_DATETIME_FORMAT), context=context)
+ date_stop = False
+ if res_obj.date_deadline:
+ date_stop = fields.datetime.context_timestamp(cr, uid, datetime.strptime(res_obj.date_deadline, tools.DEFAULT_SERVER_DATETIME_FORMAT), context=context)
body_vals = {'name': res_obj.name,
- 'start_date': res_obj.date,
- 'end_date': res_obj.date_deadline or False,
+ 'start_date': date_start,
+ 'end_date': date_stop,
+ 'timezone': tz,
'description': res_obj.description or '-',
'location': res_obj.location or '-',
'attendees': '
'.join(att_infos),
@@ -623,7 +628,7 @@ property or property parameter."),
email = filter(lambda x:x.__contains__('@'), cnval)
vals['email'] = email and email[0] or ''
vals['cn'] = vals.get("cn")
- res = super(calendar_attendee, self).create(cr, uid, vals, context)
+ res = super(calendar_attendee, self).create(cr, uid, vals, context=context)
return res
calendar_attendee()
@@ -842,7 +847,7 @@ class calendar_alarm(osv.osv):
current_datetime = datetime.now()
alarm_ids = self.search(cr, uid, [('state', '!=', 'done')], context=context)
- mail_to = []
+ mail_to = ""
for alarm in self.browse(cr, uid, alarm_ids, context=context):
next_trigger_date = None
@@ -891,9 +896,9 @@ From:
""" % (alarm.name, alarm.trigger_date, alarm.description, \
alarm.user_id.name, alarm.user_id.signature)
- mail_to = [alarm.user_id.email]
+ mail_to = alarm.user_id.email
for att in alarm.attendee_ids:
- mail_to.append(att.user_id.email)
+ mail_to = mail_to + " " + att.user_id.email
if mail_to:
vals = {
'state': 'outgoing',
@@ -1117,7 +1122,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
for att in event.attendee_ids:
attendees[att.partner_id.id] = True
new_attendees = []
- mail_to = []
+ mail_to = ""
for partner in event.partner_ids:
if partner.id in attendees:
continue
@@ -1128,7 +1133,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
'email': partner.email
}, context=context)
if partner.email:
- mail_to.append(partner.email)
+ mail_to = mail_to + " " + partner.email
self.write(cr, uid, [event.id], {
'attendee_ids': [(4, att_id)]
}, context=context)
@@ -1136,7 +1141,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
if mail_to and current_user.email:
att_obj._send_mail(cr, uid, new_attendees, mail_to,
- email_from = current_user.email)
+ email_from = current_user.email, context=context)
return True
def default_organizer(self, cr, uid, context=None):
diff --git a/addons/base_calendar/crm_meeting_view.xml b/addons/base_calendar/crm_meeting_view.xml
index 2efc76997cc..c2adc01cd54 100644
--- a/addons/base_calendar/crm_meeting_view.xml
+++ b/addons/base_calendar/crm_meeting_view.xml
@@ -181,10 +181,6 @@
-
-
-
-
diff --git a/addons/project/project.py b/addons/project/project.py
index 0534ad9a264..a0acb2ac793 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -1089,6 +1089,10 @@ class task(base_stage, osv.osv):
return True
def create(self, cr, uid, vals, context=None):
+ if not context.get('default_project_id', False) and vals.get('project_id', False):
+ ctx = context.copy()
+ ctx['default_project_id'] = vals['project_id']
+ vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx)
task_id = super(task, self).create(cr, uid, vals, context=context)
self._store_history(cr, uid, [task_id], context=context)
return task_id
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index fcc6b3d0265..f4d8e828945 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -64,6 +64,13 @@ class project_issue(base_stage, osv.osv):
},
}
+ def create(self, cr, uid, vals, context=None):
+ if not context.get('default_project_id', False) and vals.get('project_id', False):
+ ctx = context.copy()
+ ctx['default_project_id'] = vals['project_id']
+ vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx)
+ return super(project_issue, self).create(cr, uid, vals, context=context)
+
def _get_default_project_id(self, cr, uid, context=None):
""" Gives default project by checking if present in the context """
return self._resolve_project_id_from_context(cr, uid, context=context)