summaryrefslogtreecommitdiff
path: root/addons/mail
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2014-08-04 13:02:42 +0200
committerThibault Delavallée <tde@openerp.com>2014-08-04 14:46:47 +0200
commit7f0353974d7ee825d8cd63c9968e8e93c93b4888 (patch)
tree9dbdfe95e2f7f2541c97bf2db6519504a0c44514 /addons/mail
parent4152e99bbdd56f45b24fe71af6e4f58dd33358fb (diff)
[REF] mail: same_thread field changed into no_auto_thread, its contrary, to avoid migration issues (adding a 'always False' column is easier than an 'always True').
Diffstat (limited to 'addons/mail')
-rw-r--r--addons/mail/mail_message.py7
-rw-r--r--addons/mail/tests/test_mail_message.py2
-rw-r--r--addons/mail/wizard/mail_compose_message.py6
-rw-r--r--addons/mail/wizard/mail_compose_message_view.xml6
4 files changed, 10 insertions, 11 deletions
diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py
index b5457700145..8109e3422aa 100644
--- a/addons/mail/mail_message.py
+++ b/addons/mail/mail_message.py
@@ -130,8 +130,8 @@ class mail_message(osv.Model):
help="Email address of the sender. This field is set when no matching partner is found for incoming emails."),
'reply_to': fields.char('Reply-To',
help='Reply email address. Setting the reply_to bypasses the automatic thread creation.'),
- 'same_thread': fields.boolean('Same thread',
- help='Redirect answers to the same discussion thread.'),
+ 'no_auto_thread': fields.boolean('No threading for answers',
+ help='Answers do not go in the original document\' discussion thread. This has an impact on the generated message-id.'),
'author_id': fields.many2one('res.partner', 'Author', select=1,
ondelete='set null',
help="Author of the message. If not set, email_from may hold an email address that did not match any partner."),
@@ -189,7 +189,6 @@ class mail_message(osv.Model):
'author_id': lambda self, cr, uid, ctx=None: self._get_default_author(cr, uid, ctx),
'body': '',
'email_from': lambda self, cr, uid, ctx=None: self._get_default_from(cr, uid, ctx),
- 'same_thread': True,
}
#------------------------------------------------------
@@ -777,7 +776,7 @@ class mail_message(osv.Model):
return self.pool['mail.thread'].message_get_reply_to(cr, uid, [res_id], default=email_from, context=ctx)[res_id]
def _get_message_id(self, cr, uid, values, context=None):
- if values.get('same_thread', True) is False:
+ if values.get('no_auto_thread', False) is True:
message_id = tools.generate_tracking_message_id('reply_to')
elif values.get('res_id') and values.get('model'):
message_id = tools.generate_tracking_message_id('%(res_id)s-%(model)s' % values)
diff --git a/addons/mail/tests/test_mail_message.py b/addons/mail/tests/test_mail_message.py
index 40d6786e2c9..7bbc9aa5a64 100644
--- a/addons/mail/tests/test_mail_message.py
+++ b/addons/mail/tests/test_mail_message.py
@@ -90,7 +90,7 @@ class TestMailMessage(TestMail):
self.registry('ir.config_parameter').unlink(cr, uid, param_ids)
# Do: free message; specified values > default values
- msg_id = self.mail_message.create(cr, user_raoul_id, {'same_thread': False, 'reply_to': reply_to1, 'email_from': email_from1})
+ msg_id = self.mail_message.create(cr, user_raoul_id, {'no_auto_thread': True, 'reply_to': reply_to1, 'email_from': email_from1})
msg = self.mail_message.browse(cr, user_raoul_id, msg_id)
# Test: message content
self.assertIn('reply_to', msg.message_id,
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py
index 41dc4a9b438..66f843cd03a 100644
--- a/addons/mail/wizard/mail_compose_message.py
+++ b/addons/mail/wizard/mail_compose_message.py
@@ -248,7 +248,7 @@ class mail_compose_message(osv.TransientModel):
rendered_values = self.render_message_batch(cr, uid, wizard, res_ids, context=context)
# compute alias-based reply-to in batch
reply_to_value = dict.fromkeys(res_ids, None)
- if mass_mail_mode and wizard.same_thread:
+ if mass_mail_mode and not wizard.no_auto_thread:
reply_to_value = self.pool['mail.thread'].message_get_reply_to(cr, uid, res_ids, default=wizard.email_from, context=dict(context, thread_model=wizard.model))
for res_id in res_ids:
@@ -274,11 +274,11 @@ class mail_compose_message(osv.TransientModel):
email_dict = rendered_values[res_id]
mail_values['partner_ids'] += email_dict.pop('partner_ids', [])
mail_values.update(email_dict)
- if wizard.same_thread:
+ if not wizard.no_auto_thread:
mail_values.pop('reply_to')
if reply_to_value.get(res_id):
mail_values['reply_to'] = reply_to_value[res_id]
- if not wizard.same_thread and not mail_values.get('reply_to'):
+ if wizard.no_auto_thread and not mail_values.get('reply_to'):
mail_values['reply_to'] = mail_values['email_from']
# mail_mail values: body -> body_html, partner_ids -> recipient_ids
mail_values['body_html'] = mail_values.get('body', '')
diff --git a/addons/mail/wizard/mail_compose_message_view.xml b/addons/mail/wizard/mail_compose_message_view.xml
index 5d358e3992c..860e106ac0f 100644
--- a/addons/mail/wizard/mail_compose_message_view.xml
+++ b/addons/mail/wizard/mail_compose_message_view.xml
@@ -46,10 +46,10 @@
<field name="notify"
attrs="{'invisible':['|', ('composition_mode', '!=', 'mass_post')]}"/>
<!-- mass mailing -->
- <field name="same_thread" attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>
+ <field name="no_auto_thread" attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>
<field name="reply_to" placeholder="Email address to redirect replies..."
- attrs="{'invisible':['|', ('same_thread', '=', True), ('composition_mode', '!=', 'mass_mail')],
- 'required':[('same_thread', '!=', True), ('composition_mode', '=', 'mass_mail')]}"/>
+ attrs="{'invisible':['|', ('no_auto_thread', '=', False), ('composition_mode', '!=', 'mass_mail')],
+ 'required':[('no_auto_thread', '=', True), ('composition_mode', '=', 'mass_mail')]}"/>
</group>
<field name="body"/>
<field name="attachment_ids" widget="many2many_binary" string="Attach a file"/>