[MERGE] Latest trunk

bzr revid: vta@openerp.com-20121228135456-a15jyuctvwd7pb9l
This commit is contained in:
vta vta@openerp.com 2012-12-28 14:54:56 +01:00
commit ad7c08b2c4
4 changed files with 32 additions and 20 deletions

View File

@ -142,7 +142,7 @@ html_invitation = """
<td width="100%%">You are invited for <i>%(company)s</i> Event.</td>
</tr>
<tr>
<td width="100%%">Below are the details of event:</td>
<td width="100%%">Below are the details of event. Hours and dates expressed in %(timezone)s time.</td>
</tr>
</table>
@ -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': '<br>'.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:
</pre>
""" % (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):

View File

@ -181,10 +181,6 @@
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread" placeholder="Share a message..."/>
</div>
</form>
</field>
</record>

View File

@ -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

View File

@ -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)