diff --git a/web_mail_no_followers/README.rst b/web_mail_no_followers/README.rst new file mode 100644 index 00000000..91ae0a8f --- /dev/null +++ b/web_mail_no_followers/README.rst @@ -0,0 +1,4 @@ +Description +----------- +Don't add email authors as followers when +receiving a message on any object. \ No newline at end of file diff --git a/web_mail_no_followers/__init__.py b/web_mail_no_followers/__init__.py new file mode 100644 index 00000000..cceeb384 --- /dev/null +++ b/web_mail_no_followers/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010-2013 OpenERP s.a. (). +# Copyright (C) 2013 ThinkOpen Solutions Brasil (). +# Author Carlos Almeida +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import model diff --git a/web_mail_no_followers/__openerp__.py b/web_mail_no_followers/__openerp__.py new file mode 100644 index 00000000..2e72bc82 --- /dev/null +++ b/web_mail_no_followers/__openerp__.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010-2013 OpenERP s.a. (). +# Copyright (C) 2013 ThinkOpen Solutions Brasil (). +# Author Carlos Almeida +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +{ + 'name': 'Do not add followers on sending or receiving mails', + 'version': '8.0.0.1.0', + 'author': "ThinkOpen Solutions Brasil, Odoo Community Association (OCA)", + 'category': 'Web', + 'website': 'http://www.tkobr.com', + 'license': 'AGPL-3', + 'images': [], + 'depends': ['mail'], + 'data': [], +} diff --git a/web_mail_no_followers/i18n/web_fetchmail_no_followers.pot b/web_mail_no_followers/i18n/web_fetchmail_no_followers.pot new file mode 100644 index 00000000..aca3ddc6 --- /dev/null +++ b/web_mail_no_followers/i18n/web_fetchmail_no_followers.pot @@ -0,0 +1,16 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-01-15 14:24+0000\n" +"PO-Revision-Date: 2016-01-15 16:24+0100\n" +"Last-Translator: M\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" + diff --git a/web_mail_no_followers/model/__init__.py b/web_mail_no_followers/model/__init__.py new file mode 100644 index 00000000..4e58954b --- /dev/null +++ b/web_mail_no_followers/model/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010-2013 OpenERP s.a. (). +# Copyright (C) 2013 ThinkOpen Solutions Brasil (). +# Author Carlos Almeida +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import mail_thread diff --git a/web_mail_no_followers/model/mail_thread.py b/web_mail_no_followers/model/mail_thread.py new file mode 100644 index 00000000..4eb97431 --- /dev/null +++ b/web_mail_no_followers/model/mail_thread.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010-2013 OpenERP s.a. (). +# Copyright (C) 2013 ThinkOpen Solutions Brasil (). +# Author Carlos Almeida +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.addons.mail.mail_thread import mail_thread +from openerp import models, api + + +message_post_super = mail_thread.message_post + + +@api.cr_uid_ids_context +def MailNoFollowersMessageFetch(self, cr, uid, thread_id, body='', + subject=None, type='notification', + subtype=None, parent_id=False, + attachments=None, context=None, + content_subtype='html', **kwargs): + + # add mail_create_nosubscribe to not subscribe any messages for fetchmail + nosub_ctx = dict(context, mail_create_nosubscribe=True) + # remove key mail_create_nosubscribe to not subscribe partners on send + if 'mail_post_autofollow' in nosub_ctx: + del nosub_ctx['mail_post_autofollow'] + if 'mail_post_autofollow_partner_ids1' in nosub_ctx: + del nosub_ctx['mail_post_autofollow_partner_ids'] + + thread_id = message_post_super(self, cr, uid, thread_id, body=body, + subject=subject, type=type, + subtype=subtype, parent_id=parent_id, + attachments=attachments, context=nosub_ctx, + content_subtype=content_subtype, **kwargs) + return thread_id + + +class MailNoFollowers(models.Model): + ''' I define this class so this code will be executed only if module + is installed in database. Otherwise it will be always executed. + ''' + _name = 'mail.thread' + + def __init__(self, *arg, **kwargs): + mail_thread.message_post = MailNoFollowersMessageFetch diff --git a/web_mail_no_followers/static/description/icon.png b/web_mail_no_followers/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/web_mail_no_followers/static/description/icon.png differ