[FIX] Fixed the context sent by the invite wizard. Also give the author the rigth to write.

bzr revid: vta@openerp.com-20121130111223-49fpinmq82llt2cq
This commit is contained in:
vta vta@openerp.com
2012-11-30 12:12:23 +01:00
parent 6183134f4d
commit 616925f113
2 changed files with 4 additions and 3 deletions
+1 -2
View File
@@ -578,7 +578,7 @@ class mail_message(osv.Model):
model_record_ids.setdefault(rmod, dict()).setdefault(rid, set()).add(id)
# Author condition, for read and create (private message) -> could become an ir.rule, but not till we do not have a many2one variable field
if operation == 'read':
if operation == 'read' or operation == 'write':
author_ids = [mid for mid, message in message_values.iteritems()
if message.get('author_id') and message.get('author_id') == partner_id]
elif operation == 'create':
@@ -640,7 +640,6 @@ class mail_message(osv.Model):
(self._description, operation))
def create(self, cr, uid, values, context=None):
values['model'] = context.get('default_res_model') if (context and context.get('default_res_model')) else ''
if not values.get('message_id') and values.get('res_id') and values.get('model'):
values['message_id'] = tools.generate_tracking_message_id('%(res_id)s-%(model)s' % values)
elif not values.get('message_id'):
+3 -1
View File
@@ -71,12 +71,14 @@ class invite_wizard(osv.osv_memory):
# send an email
if wizard.message:
ctx = dict(context)
ctx.update({'default_res_id': False})
for follower_id in new_follower_ids:
mail_mail = self.pool.get('mail.mail')
mail_id = mail_mail.create(cr, uid, {
'subject': 'Invitation to follow %s' % document.name_get()[0][1],
'body_html': '%s' % wizard.message,
'auto_delete': True,
}, context=context)
}, context=ctx)
mail_mail.send(cr, uid, [mail_id], recipient_ids=[follower_id], context=context)
return {'type': 'ir.actions.act_window_close'}