diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 4908532c8385781d632dff451a7a667cd328a29e..9fe72cc80e20e014f22e6963b3716411872ec232 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -453,7 +453,6 @@ class hr_applicant(osv.Model): 'model': self._name, 'composition_mode': 'mass_mail', 'template_id': stage.template_id.id, - 'same_thread': True, 'post': True, 'notify': True, }, context=compose_ctx) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index b5457700145221f2466f9fc76820833fcb646c90..8109e3422aaa4789390138d3ee98e4226725817d 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 40d6786e2c930755794bb975aa012abb2d6a7e9a..7bbc9aa5a6492c2ae576c3d6ccb30ffa1198b170 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 41dc4a9b4384caec83daa0286a19bdfd0d505a3f..66f843cd03a7b14e5713f70891b0571e1f363370 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 5d358e3992c0b7c5efa7af4e07a5756407fedde6..860e106ac0f1a47067fec730d36693f6503c9577 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"/> diff --git a/addons/mass_mailing/models/mass_mailing.py b/addons/mass_mailing/models/mass_mailing.py index ae1a334f6984d5a0f8e66af54e3abc8646299fc1..b80aa43b0887ccd8a270aaa1431697b217d6ed2b 100644 --- a/addons/mass_mailing/models/mass_mailing.py +++ b/addons/mass_mailing/models/mass_mailing.py @@ -601,7 +601,7 @@ class MassMailing(osv.Model): 'composition_mode': 'mass_mail', 'mass_mailing_id': mailing.id, 'mailing_list_ids': [(4, l.id) for l in mailing.contact_list_ids], - 'same_thread': mailing.reply_to_mode == 'thread', + 'no_auto_thread': mailing.reply_to_mode != 'thread', } if mailing.reply_to_mode == 'email': composer_values['reply_to'] = mailing.reply_to