[RENAME] mail: res.partner: renamed notification_email_pref into notification_email_send, because this pref suffix is very ugly.

bzr revid: tde@openerp.com-20120829114424-fznd0ujsqnk1hve7
This commit is contained in:
Thibault Delavallée 2012-08-29 13:44:24 +02:00
parent 8b910c1f1d
commit 1d131bae84
5 changed files with 10 additions and 10 deletions

View File

@ -95,10 +95,10 @@ class mail_notification(osv.Model):
if partner.user_id.id == uid:
continue
# Partner does not want to receive any emails
if partner.notification_email_pref=='none' or not partner.email:
if partner.notification_email_send=='none' or not partner.email:
continue
# Partners want to receive only emails and comments
if partner.notification_email_pref=='comment' and msg.type not in ('email','comment'):
if partner.notification_email_send=='comment' and msg.type not in ('email','comment'):
continue
towrite['state'] = 'outgoing'

View File

@ -27,7 +27,7 @@ class res_partner_mail(osv.Model):
_inherit = ['res.partner', 'mail.thread']
_columns = {
'notification_email_pref': fields.selection([
'notification_email_send': fields.selection([
('all', 'All feeds'),
('comment', 'Comments and emails'),
('none', 'Never')
@ -37,7 +37,7 @@ class res_partner_mail(osv.Model):
}
_defaults = {
'notification_email_pref': lambda *args: 'comment'
'notification_email_send': lambda *args: 'comment'
}

View File

@ -44,14 +44,14 @@ class res_users(osv.Model):
}
def __init__(self, pool, cr):
""" Override of __init__ to add access rights on notification_email_pref
""" Override of __init__ to add access rights on notification_email_send
field. Access rights are disabled by default, but allowed on
fields defined in self.SELF_WRITEABLE_FIELDS.
"""
init_res = super(res_users, self).__init__(pool, cr)
# duplicate list to avoid modifying the original reference
self.SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
self.SELF_WRITEABLE_FIELDS.append('notification_email_pref')
self.SELF_WRITEABLE_FIELDS.append('notification_email_send')
return init_res
def _auto_init(self, cr, context=None):

View File

@ -10,7 +10,7 @@
<field name="arch" type="xml">
<data>
<field name="email" position="before">
<field name="notification_email_pref" readonly="0"/>
<field name="notification_email_send" readonly="0"/>
</field>
</data>
</field>
@ -24,7 +24,7 @@
<field name="arch" type="xml">
<data>
<field name="email" position="before">
<field name="notification_email_pref"/>
<field name="notification_email_send"/>
</field>
<field name="email" position="after">
<field name="alias_domain" invisible="1"/>

View File

@ -255,9 +255,9 @@ class test_mail(common.TransactionCase):
# 1 - Bert Tartopoils, with email, should receive emails for comments and emails
partner_bert_id = self.res_partner.create(cr, uid, {'name': 'Bert Tartopoils', 'email': 'b@b'})
# 2 - Raoul Grosbedon, without email, to test email verification; should receive emails for every message
partner_raoul_id = self.res_partner.create(cr, uid, {'name': 'Raoul Grosbedon', 'notification_email_pref': 'all'})
partner_raoul_id = self.res_partner.create(cr, uid, {'name': 'Raoul Grosbedon', 'notification_email_send': 'all'})
# 3 - Roger Poilvache, with email, should never receive emails
partner_roger_id = self.res_partner.create(cr, uid, {'name': 'Roger Poilvache', 'email': 'r@r', 'notification_email_pref': 'none'})
partner_roger_id = self.res_partner.create(cr, uid, {'name': 'Roger Poilvache', 'email': 'r@r', 'notification_email_send': 'none'})
# Create a new comment on group_pigs
compose_id = mail_compose.create(cr, uid,