[IMP] mail, test_mail, website_(form,sale): rename no_auto_thread field
PURPOSE Rename fields on mail_thread and wizard: ``no_auto_thread`` should be replaced to ``reply_to_force_new`` to ease understanding and be prefixed by reply_to. SPECIFICATIONS For better understanding, this commit renames ``no_auto_thread`` field of ``mail.message`` model to ``reply_to_force_new``, to indicate that if the field is checked (☑) replies should check gateway alias rules instead of updating mailed threads. It is also more coherent with reply_to namespacing used in various mail models (notably new composer fields and ``reply_to_mode`` of mass mailing and mail composer models) LINKS Task ID-2117639 COM PR odoo/odoo#40931 ENT PR odoo/enterprise#17941 UPG PR odoo/upgrade#2419
This commit is contained in:
committed by
Thibault Delavallée
parent
59ce7d3969
commit
e4cace7115
@@ -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)
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<group>
|
||||
<group>
|
||||
<field name="reply_to"/>
|
||||
<field name="no_auto_thread"/>
|
||||
<field name="reply_to_force_new"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="message_id"/>
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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])
|
||||
|
||||
@@ -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': _('<p>Attached files : </p>'),
|
||||
'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'),
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user