diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index ead17a89b77..d4edb7616e6 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -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'): diff --git a/addons/mail/wizard/invite.py b/addons/mail/wizard/invite.py index 50ecf9450da..c0fa410b87b 100644 --- a/addons/mail/wizard/invite.py +++ b/addons/mail/wizard/invite.py @@ -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'}