Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to disable auto-add followers in discussion groups - copy solution from mail_thread.py?

By
Tobias Frankl
on 4/12/15, 1:48 PM 1,311 views

Hello forum

We want to use discussion groups as group mail accounts for specific functions. Therefore the auto-add followers must be deactivated. Mails to contact@company.com should not add the costumer to the group.

How to achive that?

The solution in this thread worked for me to deactivate auto-add in mails to partners: code see below

https://www.odoo.com/forum/help-1/question/how-to-stop-openerp-from-adding-partner-as-followers-automatically-25601

This behavious is actually generating many issues. On my side, i have changed the file mail_thread.py from this :
# automatically subscribe recipients if asked to
if context.get('mail_post_autofollow') and thread_id and partner_ids:
partner_to_subscribe = partner_ids
if context.get('mail_post_autofollow_partner_ids'):
partner_to_subscribe = filter(lambda item: item in context.get('mail_post_autofollow_partner_ids'), partner_ids)
self.message_subscribe(cr, uid, [thread_id], list(partner_to_subscribe), context=context)
to this :
# automatically subscribe recipients if asked to
#if context.get('mail_post_autofollow') and thread_id and partner_ids:
# partner_to_subscribe = partner_ids
# if context.get('mail_post_autofollow_partner_ids'):
# partner_to_subscribe = filter(lambda item: item in context.get('mail_post_autofollow_partner_ids'), partner_ids)
# self.message_subscribe(cr, uid, [thread_id], list(partner_to_subscribe), context=context)
Now adding automatically follower is disabled.

1
Wided Kéfi
On 11/4/15, 3:50 AM

The piece of code you mentioned is only to prevent adding message recipients from being added automatically as followers.

You have also to prevent senders from being automatically added as followers by modifying this bloc in mail/mail_thread.py:

# Create and auto subscribe the author

msg_id = mail_message.create(cr, uid, values, context=context)

message = mail_message.browse(cr, uid, msg_id, context=context)

if message.author_id and thread_id and type != 'notification' and not context.get('mail_create_nosubscribe'):

        self.message_subscribe(cr, uid, [thread_id], [message.author_id.id], context=context)

return msg_id


to this:


# Create and auto subscribe the author

msg_id = mail_message.create(cr, uid, values, context=context)

message = mail_message.browse(cr, uid, msg_id, context=context)

"""if message.author_id and thread_id and type != 'notification' and not context.get('mail_create_nosubscribe'):

self.message_subscribe(cr, uid, [thread_id], [message.author_id.id], context=context)"""

return msg_id

0
IT Libertas
On 3/13/16, 6:32 PM

Maybe, this module https://apps.odoo.com/apps/modules/9.0/compoze_no_auto_subscribe/ would be of use to your needs

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 4/12/15, 1:48 PM
Seen: 1311 times
Last updated: 3/13/16, 6:32 PM