# filter partner_ids to get the new followers, to avoid sending email to already following partners
new_follower_ids = [p.id for p in wizard.partner_ids if p.id not in document.message_follower_ids]
model_obj.message_subscribe(cr, uid, [wizard.res_id], new_follower_ids, context=context)
-
+
# send an email
if wizard.message:
+ # the invite wizard should create a private message not related to any object,
- # we ensure that by removing default res_id and res_model from the context
- context.pop('default_res_id', False)
- context.pop('default_model', False)
++ # we ensure that by overwriting off res_id and res_model default value of the context
for follower_id in new_follower_ids:
mail_mail = self.pool.get('mail.mail')
mail_id = mail_mail.create(cr, uid, {