diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index 64d580dcab4..36ea4ba46cf 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -156,9 +156,9 @@ class Message(models.Model): help='Tracked values are stored in a separate model. This field allow to reconstruct ' 'the tracking and to generate statistics on the model.') # mail gateway - no_auto_thread = fields.Boolean( + reply_to_force_new = 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.') + help='If true, answers do not go in the original document discussion thread. Instead, it will check for the reply_to in tracking message-id and redirected accordingly. This has an impact on the generated message-id.') message_id = fields.Char('Message-Id', help='Message unique identifier', index=True, readonly=1, copy=False) reply_to = fields.Char('Reply-To', help='Reply email address. Setting the reply_to bypasses the automatic thread creation.') mail_server_id = fields.Many2one('ir.mail_server', 'Outgoing mail server') @@ -1207,7 +1207,7 @@ class Message(models.Model): @api.model def _get_message_id(self, values): - if values.get('no_auto_thread', False) is True: + if values.get('reply_to_force_new', False) is True: message_id = tools.generate_tracking_message_id('reply_to') elif self.is_thread_message(values): message_id = tools.generate_tracking_message_id('%(res_id)s-%(model)s' % values) diff --git a/addons/mail/views/mail_message_views.xml b/addons/mail/views/mail_message_views.xml index 401c4131e2c..57d3df6316b 100644 --- a/addons/mail/views/mail_message_views.xml +++ b/addons/mail/views/mail_message_views.xml @@ -52,7 +52,7 @@ - + diff --git a/addons/mail/wizard/invite.py b/addons/mail/wizard/invite.py index ffafa2788be..ef4400441ab 100644 --- a/addons/mail/wizard/invite.py +++ b/addons/mail/wizard/invite.py @@ -67,7 +67,7 @@ class Invite(models.TransientModel): 'reply_to': email_from, 'model': wizard.res_model, 'res_id': wizard.res_id, - 'no_auto_thread': True, + 'reply_to_force_new': True, 'add_sign': True, }) partners_data = [] diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index 4ff8e19e2f3..1b0e4437160 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -315,7 +315,7 @@ class MailComposer(models.TransientModel): 'author_id': self.author_id.id, 'email_from': self.email_from, 'record_name': self.record_name, - 'no_auto_thread': self.reply_to_force_new, + 'reply_to_force_new': self.reply_to_force_new, 'mail_server_id': self.mail_server_id.id, 'mail_activity_type_id': self.mail_activity_type_id.id, } diff --git a/addons/test_mail/tests/test_mail_gateway.py b/addons/test_mail/tests/test_mail_gateway.py index 8da6b228b9f..b76e5d9752b 100644 --- a/addons/test_mail/tests/test_mail_gateway.py +++ b/addons/test_mail/tests/test_mail_gateway.py @@ -1043,14 +1043,14 @@ class TestMailgateway(TestMailCommon): first_record = self.env['mail.test.simple'].with_user(self.user_employee).create({'name': 'Replies to Record'}) record_msg = first_record.message_post( subject='Discussion', - no_auto_thread=False, + reply_to_force_new=False, subtype_xmlid='mail.mt_comment', ) self.assertEqual(record_msg.reply_to, formataddr(('%s %s' % (self.user_employee.company_id.name, first_record.name), '%s@%s' % ('catchall.test', 'test.com')))) mail_msg = first_record.message_post( subject='Replies to Record', reply_to='groups@test.com', - no_auto_thread=True, + reply_to_force_new=True, subtype_xmlid='mail.mt_comment', ) self.assertEqual(mail_msg.reply_to, 'groups@test.com') diff --git a/addons/test_mail/tests/test_mail_message.py b/addons/test_mail/tests/test_mail_message.py index 8cf04011b6b..c654d9f58fc 100644 --- a/addons/test_mail/tests/test_mail_message.py +++ b/addons/test_mail/tests/test_mail_message.py @@ -169,11 +169,11 @@ class TestMessageValues(TestMailCommon): self.assertEqual(msg.reply_to, formataddr((reply_to_name, reply_to_email))) self.assertEqual(msg.email_from, formataddr((self.user_employee.name, self.user_employee.email))) - def test_mail_message_values_no_auto_thread(self): + def test_mail_message_values_reply_to_force_new(self): msg = self.Message.create({ 'model': 'mail.test.container', 'res_id': self.alias_record.id, - 'no_auto_thread': True, + 'reply_to_force_new': True, }) self.assertIn('reply_to', msg.message_id.split('@')[0]) self.assertNotIn('mail.test.container', msg.message_id.split('@')[0]) diff --git a/addons/website_form/controllers/main.py b/addons/website_form/controllers/main.py index 3d3bdb87812..5a60a7e60a3 100644 --- a/addons/website_form/controllers/main.py +++ b/addons/website_form/controllers/main.py @@ -223,7 +223,6 @@ class WebsiteForm(http.Controller): 'body': nl2br(custom_content), 'model': model_name, 'message_type': 'comment', - 'no_auto_thread': False, 'res_id': record.id, } mail_id = request.env['mail.message'].with_user(SUPERUSER_ID).create(values) @@ -258,7 +257,6 @@ class WebsiteForm(http.Controller): 'body': _('

Attached files :

'), 'model': model_name, 'message_type': 'comment', - 'no_auto_thread': False, 'res_id': id_record, 'attachment_ids': [(6, 0, orphan_attachment_ids)], 'subtype_id': request.env['ir.model.data'].xmlid_to_res_id('mail.mt_comment'), diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 5c867047313..6e3433e9fa7 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -109,7 +109,6 @@ class WebsiteSaleForm(WebsiteForm): 'body': nl2br(data['custom']), 'model': 'sale.order', 'message_type': 'comment', - 'no_auto_thread': False, 'res_id': order.id, } request.env['mail.message'].with_user(SUPERUSER_ID).create(values)