summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2013-03-06 15:27:41 +0100
committerThibault Delavallée <tde@openerp.com>2013-03-06 15:27:41 +0100
commitaa054ebb744bd07b65d28949adc239ac82cd80a1 (patch)
tree7a90e40a23aef75c08ac8680d858651654ade84d
parent1f4002447e40f4e424dc7cba65c727f41f900894 (diff)
[REV] mail: reverted commit 8802. Reason: opt-out will be used only for marketing campaigns; notification_email_send for emails.
bzr revid: tde@openerp.com-20130306142741-ghazensh58xw3rvu
-rw-r--r--addons/mail/mail_followers.py7
-rw-r--r--addons/mail/wizard/invite.py22
2 files changed, 6 insertions, 23 deletions
diff --git a/addons/mail/mail_followers.py b/addons/mail/mail_followers.py
index 2e97bee8a56..ecdd39874e3 100644
--- a/addons/mail/mail_followers.py
+++ b/addons/mail/mail_followers.py
@@ -82,11 +82,6 @@ class mail_notification(osv.Model):
:param list partners_to_notify: optional list of partner ids restricting
the notifications to process
"""
- # TDE FIXME HACK: as notification_email_send is not present on the partner
- # form view, and as opt_out can be used once CRM is installed, we have to
- # perform this ugly columns check to use the parameter
- # Please remove me in 8.0 (hint: remove opt_out -> notification to 'never')
- has_opt_out = self.pool.get('res.partner')._all_columns.get('opt_out')
notify_pids = []
for notification in message.notification_ids:
if notification.read:
@@ -99,7 +94,7 @@ class mail_notification(osv.Model):
if not partner.email:
continue
# Partner does not want to receive any emails or is opt-out
- if partner.notification_email_send == 'none' or (has_opt_out and partner.opt_out):
+ if partner.notification_email_send == 'none':
continue
# Partner wants to receive only emails and comments
if partner.notification_email_send == 'comment' and message.type not in ('email', 'comment'):
diff --git a/addons/mail/wizard/invite.py b/addons/mail/wizard/invite.py
index 7e80300b132..091f8c3b569 100644
--- a/addons/mail/wizard/invite.py
+++ b/addons/mail/wizard/invite.py
@@ -19,7 +19,6 @@
#
##############################################################################
-from openerp import SUPERUSER_ID
from openerp import tools
from openerp.osv import osv
from openerp.osv import fields
@@ -52,19 +51,12 @@ class invite_wizard(osv.osv_memory):
}
def add_followers(self, cr, uid, ids, context=None):
- # TDE FIXME HACK: as notification_email_send is not present on the partner
- # form view, and as opt_out can be used once CRM is installed, we have to
- # perform this ugly columns check to use the parameter
- # Please remove me in 8.0 (hint: remove opt_out -> notification to 'never')
- has_opt_out = self.pool.get('res.partner')._all_columns.get('opt_out')
-
- for wizard in self.browse(cr, SUPERUSER_ID, ids, context=context):
+ for wizard in self.browse(cr, uid, ids, context=context):
model_obj = self.pool.get(wizard.res_model)
document = model_obj.browse(cr, uid, wizard.res_id, context=context)
# filter partner_ids to get the new followers, to avoid sending email to already following partners
- new_followers = [p for p in wizard.partner_ids if p.id not in document.message_follower_ids]
- new_follower_ids = [p.id for p in new_followers]
+ 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
@@ -74,12 +66,8 @@ class invite_wizard(osv.osv_memory):
signature = user_id and user_id["signature"] or ''
if signature:
wizard.message = tools.append_content_to_html(wizard.message, signature, plaintext=True, container_tag='div')
- # send mail to new followers, unless it is opt-out
- # FIXME 8.0: use notification_email_send, send a wall message
- # and let mail handle email notification
- for follower in new_followers:
- if has_opt_out and follower.opt_out:
- continue
+ # FIXME 8.0: use notification_email_send, send a wall message and let mail handle email notification + message box
+ for follower_id in new_follower_ids:
mail_mail = self.pool.get('mail.mail')
# the invite wizard should create a private message not related to any object -> no model, no res_id
mail_id = mail_mail.create(cr, uid, {
@@ -89,5 +77,5 @@ class invite_wizard(osv.osv_memory):
'body_html': '%s' % wizard.message,
'auto_delete': True,
}, context=context)
- mail_mail.send(cr, uid, [mail_id], recipient_ids=[follower.id], context=context)
+ mail_mail.send(cr, uid, [mail_id], recipient_ids=[follower_id], context=context)
return {'type': 'ir.actions.act_window_close'}