diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py index 98f25ab908a..97e131702ae 100644 --- a/addons/calendar/models/calendar.py +++ b/addons/calendar/models/calendar.py @@ -226,7 +226,7 @@ class Attendee(models.Model): result = self.write({'state': 'accepted'}) for attendee in self: if attendee.event_id: - attendee.event_id.message_post(body=_("%s has accepted invitation") % (attendee.common_name), subtype="calendar.subtype_invitation") + attendee.event_id.message_post(body=_("%s has accepted invitation") % (attendee.common_name), subtype_xmlid="calendar.subtype_invitation") return result def do_decline(self): @@ -234,7 +234,7 @@ class Attendee(models.Model): res = self.write({'state': 'declined'}) for attendee in self: if attendee.event_id: - attendee.event_id.message_post(body=_("%s has declined invitation") % (attendee.common_name), subtype="calendar.subtype_invitation") + attendee.event_id.message_post(body=_("%s has declined invitation") % (attendee.common_name), subtype_xmlid="calendar.subtype_invitation") return res diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py index 868e46d1fdf..50254967205 100644 --- a/addons/gamification/models/challenge.py +++ b/addons/gamification/models/challenge.py @@ -562,13 +562,13 @@ class Challenge(models.Model): challenge.message_post( body=body_html, partner_ids=challenge.mapped('user_ids.partner_id.id'), - subtype='mail.mt_comment', + subtype_xmlid='mail.mt_comment', email_layout_xmlid='mail.mail_notification_light', ) if challenge.report_message_group_id: challenge.report_message_group_id.message_post( body=body_html, - subtype='mail.mt_comment') + subtype_xmlid='mail.mt_comment') else: # generate individual reports @@ -586,13 +586,13 @@ class Challenge(models.Model): challenge.message_notify( body=body_html, partner_ids=[user.partner_id.id], - subtype='mail.mt_comment', + subtype_xmlid='mail.mt_comment', email_layout_xmlid='mail.mail_notification_light', ) if challenge.report_message_group_id: challenge.report_message_group_id.message_post( body=body_html, - subtype='mail.mt_comment', + subtype_xmlid='mail.mt_comment', email_layout_xmlid='mail.mail_notification_light', ) return challenge.write({'last_report_date': fields.Date.today()}) diff --git a/addons/gamification/models/goal.py b/addons/gamification/models/goal.py index f78012d236b..80803449897 100644 --- a/addons/gamification/models/goal.py +++ b/addons/gamification/models/goal.py @@ -219,7 +219,7 @@ class Goal(models.Model): self.message_notify( body=body_html, partner_ids=[self.user_id.partner_id.id], - subtype='mail.mt_comment', + subtype_xmlid='mail.mt_comment', email_layout_xmlid='mail.mail_notification_light', ) diff --git a/addons/hr_holidays/models/hr_leave.py b/addons/hr_holidays/models/hr_leave.py index b5d5c1a3458..6c05fc2c61e 100644 --- a/addons/hr_holidays/models/hr_leave.py +++ b/addons/hr_holidays/models/hr_leave.py @@ -666,7 +666,7 @@ class HolidaysRequest(models.Model): # Automatic validation should be done in sudo, because user might not have the rights to do it by himself holiday_sudo.action_validate() holiday_sudo.message_subscribe(partner_ids=[holiday._get_responsible_for_approval().partner_id.id]) - holiday_sudo.message_post(body=_("The time off has been automatically approved"), subtype="mt_comment") # Message from OdooBot (sudo) + holiday_sudo.message_post(body=_("The time off has been automatically approved"), subtype_xmlid="mail.mt_comment") # Message from OdooBot (sudo) elif not self._context.get('import_file'): holiday_sudo.activity_update() return holiday diff --git a/addons/hr_holidays/tests/test_access_rights.py b/addons/hr_holidays/tests/test_access_rights.py index 1a8632f51a9..8781548ad27 100644 --- a/addons/hr_holidays/tests/test_access_rights.py +++ b/addons/hr_holidays/tests/test_access_rights.py @@ -608,7 +608,7 @@ class TestAccessRightsWrite(TestHrHolidaysAccessRightsCommon): """ User may communicate on its own leaves, even if validated """ self.employee_leave.with_user(self.user_employee_id).message_post( body='I haz messaging', - subtype='mail.mt_comment', + subtype_xmlid='mail.mt_comment', message_type='comment' ) @@ -616,7 +616,7 @@ class TestAccessRightsWrite(TestHrHolidaysAccessRightsCommon): self.employee_leave.with_user(self.user_employee_id).message_post( body='I still haz messaging', - subtype='mail.mt_comment', + subtype_xmlid='mail.mt_comment', message_type='comment' ) diff --git a/addons/hr_recruitment/models/hr_recruitment.py b/addons/hr_recruitment/models/hr_recruitment.py index ad0a2f32e84..2a6fca31b05 100644 --- a/addons/hr_recruitment/models/hr_recruitment.py +++ b/addons/hr_recruitment/models/hr_recruitment.py @@ -448,7 +448,7 @@ class Applicant(models.Model): applicant.job_id.write({'no_of_hired_employee': applicant.job_id.no_of_hired_employee + 1}) applicant.job_id.message_post( body=_('New Employee %s Hired') % applicant.partner_name if applicant.partner_name else applicant.name, - subtype="hr_recruitment.mt_job_applicant_hired") + subtype_xmlid="hr_recruitment.mt_job_applicant_hired") applicant.message_post_with_view( 'hr_recruitment.applicant_hired_template', values={'applicant': applicant}, diff --git a/addons/mail/controllers/bus.py b/addons/mail/controllers/bus.py index 81f1700987d..ccbe6bdeb5f 100644 --- a/addons/mail/controllers/bus.py +++ b/addons/mail/controllers/bus.py @@ -53,7 +53,7 @@ class MailChatController(BusController): message = mail_channel.with_context(mail_create_nosubscribe=True).message_post(author_id=author_id, email_from=email_from, body=body, message_type='comment', - subtype='mail.mt_comment') + subtype_xmlid='mail.mt_comment') return message and message.id or False @route(['/mail/chat_history'], type="json", auth="public", cors="*") diff --git a/addons/mail/controllers/home.py b/addons/mail/controllers/home.py index b4c4bd5d93d..9d54b6ebd1c 100644 --- a/addons/mail/controllers/home.py +++ b/addons/mail/controllers/home.py @@ -27,7 +27,7 @@ def _admin_password_warn(uid): .message_post( body=_("Your password is the default (admin)! If this system is exposed to untrusted users it is important to change it immediately for security reasons. I will keep nagging you about it!"), message_type='comment', - subtype='mail.mt_comment' + subtype_xmlid='mail.mt_comment' ) class Home(web.Home): diff --git a/addons/mail/models/mail_channel.py b/addons/mail/models/mail_channel.py index 2d3c54a9591..f78a415b522 100644 --- a/addons/mail/models/mail_channel.py +++ b/addons/mail/models/mail_channel.py @@ -280,7 +280,7 @@ class Channel(models.Model): if not self.email_send: notification = _('
%s"
% (rate, rate, feedback),
- subtype=subtype or "mail.mt_comment",
+ subtype_xmlid=subtype_xmlid or "mail.mt_comment",
author_id=rating.partner_id and rating.partner_id.id or None # None will set the default author in mail_thread.py
)
if hasattr(self, 'stage_id') and self.stage_id and hasattr(self.stage_id, 'auto_validation_kanban_state') and self.stage_id.auto_validation_kanban_state:
diff --git a/addons/sale/controllers/portal.py b/addons/sale/controllers/portal.py
index 52495a93316..e951dce54b2 100644
--- a/addons/sale/controllers/portal.py
+++ b/addons/sale/controllers/portal.py
@@ -159,7 +159,7 @@ class CustomerPortal(CustomerPortal):
if order_sudo and request.session.get('view_quote_%s' % order_sudo.id) != now and request.env.user.share and access_token:
request.session['view_quote_%s' % order_sudo.id] = now
body = _('Quotation viewed by customer %s') % order_sudo.partner_id.name
- _message_post_helper('sale.order', order_sudo.id, body, token=order_sudo.access_token, message_type='notification', subtype="mail.mt_note")
+ _message_post_helper('sale.order', order_sudo.id, body, token=order_sudo.access_token, message_type='notification', subtype_xmlid="mail.mt_note")
values = {
'sale_order': order_sudo,
diff --git a/addons/test_mail/tests/test_discuss.py b/addons/test_mail/tests/test_discuss.py
index 5667568ead0..e2bda7dc8d9 100644
--- a/addons/test_mail/tests/test_discuss.py
+++ b/addons/test_mail/tests/test_discuss.py
@@ -15,7 +15,7 @@ class TestChatterTweaks(TestMailCommon, TestRecipients):
def test_post_no_subscribe_author(self):
original = self.test_record.message_follower_ids
self.test_record.with_user(self.user_employee).with_context({'mail_create_nosubscribe': True}).message_post(
- body='Test Body', message_type='comment', subtype='mt_comment')
+ body='Test Body', message_type='comment', subtype_xmlid='mail.mt_comment')
self.assertEqual(self.test_record.message_follower_ids.mapped('partner_id'), original.mapped('partner_id'))
self.assertEqual(self.test_record.message_follower_ids.mapped('channel_id'), original.mapped('channel_id'))
@@ -23,7 +23,7 @@ class TestChatterTweaks(TestMailCommon, TestRecipients):
def test_post_no_subscribe_recipients(self):
original = self.test_record.message_follower_ids
self.test_record.with_user(self.user_employee).with_context({'mail_create_nosubscribe': True}).message_post(
- body='Test Body', message_type='comment', subtype='mt_comment', partner_ids=[self.partner_1.id, self.partner_2.id])
+ body='Test Body', message_type='comment', subtype_xmlid='mail.mt_comment', partner_ids=[self.partner_1.id, self.partner_2.id])
self.assertEqual(self.test_record.message_follower_ids.mapped('partner_id'), original.mapped('partner_id'))
self.assertEqual(self.test_record.message_follower_ids.mapped('channel_id'), original.mapped('channel_id'))
@@ -31,7 +31,7 @@ class TestChatterTweaks(TestMailCommon, TestRecipients):
def test_post_subscribe_recipients(self):
original = self.test_record.message_follower_ids
self.test_record.with_user(self.user_employee).with_context({'mail_create_nosubscribe': True, 'mail_post_autofollow': True}).message_post(
- body='Test Body', message_type='comment', subtype='mt_comment', partner_ids=[self.partner_1.id, self.partner_2.id])
+ body='Test Body', message_type='comment', subtype_xmlid='mail.mt_comment', partner_ids=[self.partner_1.id, self.partner_2.id])
self.assertEqual(self.test_record.message_follower_ids.mapped('partner_id'), original.mapped('partner_id') | self.partner_1 | self.partner_2)
self.assertEqual(self.test_record.message_follower_ids.mapped('channel_id'), original.mapped('channel_id'))
@@ -100,7 +100,7 @@ class TestDiscuss(TestMailCommon, TestRecipients):
def test_set_message_done_user(self):
with self.assertSinglePostNotifications([{'partner': self.partner_employee, 'type': 'inbox'}], message_info={'content': 'Test'}):
message = self.test_record.message_post(
- body='Test', message_type='comment', subtype='mail.mt_comment',
+ body='Test', message_type='comment', subtype_xmlid='mail.mt_comment',
partner_ids=[self.user_employee.partner_id.id])
message.with_user(self.user_employee).set_message_done()
self.assertMailNotifications(message, [{'notif': [{'partner': self.partner_employee, 'type': 'inbox', 'is_read': True}]}])
diff --git a/addons/test_mail/tests/test_mail_channel.py b/addons/test_mail/tests/test_mail_channel.py
index 5dadf2690b7..8869ac21442 100644
--- a/addons/test_mail/tests/test_mail_channel.py
+++ b/addons/test_mail/tests/test_mail_channel.py
@@ -149,7 +149,7 @@ class TestChannelFeatures(TestMailCommon):
self.assertEqual(self.test_channel.channel_partner_ids, self.env['res.partner'])
def test_channel_post_nofollow(self):
- self.test_channel.message_post(body='Test', message_type='comment', subtype='mt_comment')
+ self.test_channel.message_post(body='Test', message_type='comment', subtype_xmlid='mail.mt_comment')
self.assertEqual(self.test_channel.message_channel_ids, self.test_channel)
self.assertEqual(self.test_channel.message_partner_ids, self.env['res.partner'])
@@ -168,7 +168,7 @@ class TestChannelFeatures(TestMailCommon):
})
self._join_channel(self.test_channel, self.user_employee.partner_id | self.test_partner | nomail.partner_id)
with self.mock_mail_gateway():
- self.test_channel.message_post(body="Test", message_type='comment', subtype='mt_comment')
+ self.test_channel.message_post(body="Test", message_type='comment', subtype_xmlid='mail.mt_comment')
self.assertSentEmail(self.test_channel.env.user.partner_id, [self.partner_employee, self.test_partner])
@mute_logger('odoo.addons.mail.models.mail_mail', 'odoo.models.unlink')
@@ -178,7 +178,7 @@ class TestChannelFeatures(TestMailCommon):
self.test_channel.write({'email_send': False})
self._join_channel(self.test_channel, self.user_employee.partner_id | self.test_partner)
with self.mock_mail_gateway():
- self.test_channel.message_post(body="Test", message_type='comment', subtype='mt_comment')
+ self.test_channel.message_post(body="Test", message_type='comment', subtype_xmlid='mail.mt_comment')
self.assertNotSentEmail()
self.assertEqual(len(self._mails), 0)
@@ -188,7 +188,7 @@ class TestChannelFeatures(TestMailCommon):
self.test_channel.write({'alias_name': False})
self.test_channel.message_subscribe([self.user_employee.partner_id.id, self.test_partner.id])
with self.mock_mail_gateway():
- self.test_channel.message_post(body="Test", message_type='comment', subtype='mt_comment')
+ self.test_channel.message_post(body="Test", message_type='comment', subtype_xmlid='mail.mt_comment')
self.assertSentEmail(self.test_channel.env.user.partner_id, [self.test_partner])
@mute_logger('odoo.addons.mail.models.mail_mail')
@@ -323,10 +323,10 @@ class TestChannelModeration(TestMailCommon):
self.channel_1._update_moderation_email([email1], 'ban')
self.channel_1._update_moderation_email([email2], 'allow')
- msg_admin = self.channel_1.message_post(message_type='email', subtype='mt_comment', author_id=self.partner_admin.id)
- msg_moderator = self.channel_1.message_post(message_type='comment', subtype='mt_comment', author_id=self.partner_employee.id)
- msg_email1 = self.channel_1.message_post(message_type='comment', subtype='mt_comment', email_from=formataddr(("MyName", email1)))
- msg_email2 = self.channel_1.message_post(message_type='email', subtype='mt_comment', email_from=email2)
+ msg_admin = self.channel_1.message_post(message_type='email', subtype_xmlid='mail.mt_comment', author_id=self.partner_admin.id)
+ msg_moderator = self.channel_1.message_post(message_type='comment', subtype_xmlid='mail.mt_comment', author_id=self.partner_employee.id)
+ msg_email1 = self.channel_1.message_post(message_type='comment', subtype_xmlid='mail.mt_comment', email_from=formataddr(("MyName", email1)))
+ msg_email2 = self.channel_1.message_post(message_type='email', subtype_xmlid='mail.mt_comment', email_from=email2)
msg_notif = self.channel_1.message_post()
messages = self.env['mail.message'].search([('model', '=', 'mail.channel'), ('res_id', '=', self.channel_1.id)])
diff --git a/addons/test_mail/tests/test_mail_gateway.py b/addons/test_mail/tests/test_mail_gateway.py
index 9850243ba7c..d9da245a1e0 100644
--- a/addons/test_mail/tests/test_mail_gateway.py
+++ b/addons/test_mail/tests/test_mail_gateway.py
@@ -626,14 +626,14 @@ class TestMailgateway(TestMailCommon):
record_msg = first_record.message_post(
subject='Discussion',
no_auto_thread=False,
- subtype='mail.mt_comment',
+ 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,
- subtype='mail.mt_comment',
+ 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 3f433496f4e..4f08f0abc18 100644
--- a/addons/test_mail/tests/test_mail_message.py
+++ b/addons/test_mail/tests/test_mail_message.py
@@ -360,13 +360,13 @@ class TestMessageAccess(TestMailCommon):
).with_context({'mail_create_nosubscribe': False})
# mark all as read clear needactions
- group_private.message_post(body='Test', message_type='comment', subtype='mail.mt_comment', partner_ids=[emp_partner.id])
+ group_private.message_post(body='Test', message_type='comment', subtype_xmlid='mail.mt_comment', partner_ids=[emp_partner.id])
emp_partner.env['mail.message'].mark_all_as_read(domain=[])
na_count = emp_partner.get_needaction_count()
self.assertEqual(na_count, 0, "mark all as read should conclude all needactions")
# mark all as read also clear inaccessible needactions
- new_msg = group_private.message_post(body='Zest', message_type='comment', subtype='mail.mt_comment', partner_ids=[emp_partner.id])
+ new_msg = group_private.message_post(body='Zest', message_type='comment', subtype_xmlid='mail.mt_comment', partner_ids=[emp_partner.id])
needaction_accessible = len(emp_partner.env['mail.message'].search([['needaction', '=', True]]))
self.assertEqual(needaction_accessible, 1, "a new message to a partner is readable to that partner")
@@ -388,13 +388,13 @@ class TestMessageAccess(TestMailCommon):
portal_partner = self.user_portal.partner_id.with_user(self.user_portal)
# mark all as read clear needactions
- self.group_pigs.message_post(body='Test', message_type='comment', subtype='mail.mt_comment', partner_ids=[portal_partner.id])
+ self.group_pigs.message_post(body='Test', message_type='comment', subtype_xmlid='mail.mt_comment', partner_ids=[portal_partner.id])
portal_partner.env['mail.message'].mark_all_as_read(domain=[])
na_count = portal_partner.get_needaction_count()
self.assertEqual(na_count, 0, "mark all as read should conclude all needactions")
# mark all as read also clear inaccessible needactions
- new_msg = self.group_pigs.message_post(body='Zest', message_type='comment', subtype='mail.mt_comment', partner_ids=[portal_partner.id])
+ new_msg = self.group_pigs.message_post(body='Zest', message_type='comment', subtype_xmlid='mail.mt_comment', partner_ids=[portal_partner.id])
needaction_accessible = len(portal_partner.env['mail.message'].search([['needaction', '=', True]]))
self.assertEqual(needaction_accessible, 1, "a new message to a partner is readable to that partner")
diff --git a/addons/test_mail/tests/test_message_management.py b/addons/test_mail/tests/test_message_management.py
index cc3cb367574..b2c437ce2db 100644
--- a/addons/test_mail/tests/test_message_management.py
+++ b/addons/test_mail/tests/test_message_management.py
@@ -36,7 +36,7 @@ class TestMailResend(TestMailCommon):
[{'partner': partner, 'type': 'email', 'status': 'exception'} for partner in self.partners],
message_info={'message_type': 'notification'},
sim_error='connect_failure'):
- message = self.test_record.with_user(self.user_admin).message_post(partner_ids=self.partners.ids, subtype='mail.mt_comment', message_type='notification')
+ message = self.test_record.with_user(self.user_admin).message_post(partner_ids=self.partners.ids, subtype_xmlid='mail.mt_comment', message_type='notification')
wizard = self.env['mail.resend.message'].with_context({'mail_message_to_resend': message.id}).create({})
self.assertEqual(wizard.notification_ids.mapped('res_partner_id'), self.partners, "wizard should manage notifications for each failed partner")
@@ -80,7 +80,7 @@ class TestMailResend(TestMailCommon):
def test_remove_mail_become_canceled(self):
# two failure sent on bus, one for each mail
with self.mock_mail_gateway(), self.assertBus([(self.cr.dbname, 'res.partner', self.partner_admin.id)] * 2):
- message = self.test_record.with_user(self.user_admin).message_post(partner_ids=self.partners.ids, subtype='mail.mt_comment', message_type='notification')
+ message = self.test_record.with_user(self.user_admin).message_post(partner_ids=self.partners.ids, subtype_xmlid='mail.mt_comment', message_type='notification')
self.assertMailNotifications(message, [
{'content': '', 'message_type': 'notification',
@@ -102,7 +102,7 @@ class TestMailResend(TestMailCommon):
@mute_logger('odoo.addons.mail.models.mail_mail')
def test_cancel_all(self):
with self.mock_mail_gateway(), self.assertBus([(self.cr.dbname, 'res.partner', self.partner_admin.id)] * 2):
- message = self.test_record.with_user(self.user_admin).message_post(partner_ids=self.partners.ids, subtype='mail.mt_comment', message_type='notification')
+ message = self.test_record.with_user(self.user_admin).message_post(partner_ids=self.partners.ids, subtype_xmlid='mail.mt_comment', message_type='notification')
wizard = self.env['mail.resend.message'].with_context({'mail_message_to_resend': message.id}).create({})
# one update for cancell
diff --git a/addons/test_mail/tests/test_message_post.py b/addons/test_mail/tests/test_message_post.py
index bf894fafe12..8e0a06320fb 100644
--- a/addons/test_mail/tests/test_message_post.py
+++ b/addons/test_mail/tests/test_message_post.py
@@ -27,7 +27,7 @@ class TestMessagePost(TestMailCommon, TestRecipients):
(self.user_employee | self.user_admin).write({'notification_type': 'inbox'})
with self.assertSinglePostNotifications([{'partner': self.partner_employee, 'type': 'inbox'}], {'content': 'Body'}):
self.test_record.message_post(
- body='Body', message_type='comment', subtype='mail.mt_comment',
+ body='Body', message_type='comment', subtype_xmlid='mail.mt_comment',
partner_ids=[self.user_employee.partner_id.id])
self.test_record.message_subscribe([self.partner_1.id])
@@ -35,14 +35,14 @@ class TestMessagePost(TestMailCommon, TestRecipients):
{'partner': self.partner_employee, 'type': 'inbox'},
{'partner': self.partner_1, 'type': 'email'}], {'content': 'NewBody'}):
self.test_record.message_post(
- body='NewBody', message_type='comment', subtype='mail.mt_comment',
+ body='NewBody', message_type='comment', subtype_xmlid='mail.mt_comment',
partner_ids=[self.user_employee.partner_id.id])
with self.assertSinglePostNotifications([
{'partner': self.partner_1, 'type': 'email'},
{'partner': self.partner_portal, 'type': 'email'}], {'content': 'ToPortal'}):
self.test_record.message_post(
- body='ToPortal', message_type='comment', subtype='mail.mt_comment',
+ body='ToPortal', message_type='comment', subtype_xmlid='mail.mt_comment',
partner_ids=[self.partner_portal.id])
def test_post_inactive_follower(self):
@@ -52,14 +52,14 @@ class TestMessagePost(TestMailCommon, TestRecipients):
self.test_record._message_subscribe(self.user_employee.partner_id.ids)
with self.assertSinglePostNotifications([{'partner': self.partner_employee, 'type': 'inbox'}], {'content': 'Test'}):
self.test_record.message_post(
- body='Test', message_type='comment', subtype='mail.mt_comment')
+ body='Test', message_type='comment', subtype_xmlid='mail.mt_comment')
self.user_employee.active = False
# at this point, partner is still active and would receive an email notification
self.user_employee.partner_id._write({'active': False})
with self.assertPostNotifications([{'content': 'Test', 'notif': []}]):
self.test_record.message_post(
- body='Test', message_type='comment', subtype='mail.mt_comment')
+ body='Test', message_type='comment', subtype_xmlid='mail.mt_comment')
@mute_logger('odoo.addons.mail.models.mail_mail')
def test_post_notifications(self):
@@ -74,7 +74,7 @@ class TestMessagePost(TestMailCommon, TestRecipients):
{'partner': self.partner_admin, 'type': 'email'}], {'content': _body}, mail_unlink_sent=True):
msg = self.test_record.with_user(self.user_employee).message_post(
body=_body, subject=_subject,
- message_type='comment', subtype='mt_comment',
+ message_type='comment', subtype_xmlid='mail.mt_comment',
partner_ids=[self.partner_1.id, self.partner_2.id]
)
@@ -95,7 +95,7 @@ class TestMessagePost(TestMailCommon, TestRecipients):
msg = self.test_record.with_user(self.user_employee).message_post(
body='Test', subject='Test',
- message_type='comment', subtype='mt_comment',
+ message_type='comment', subtype_xmlid='mail.mt_comment',
partner_ids=[self.partner_1.id, self.partner_2.id],
mail_auto_delete=False
)
@@ -126,7 +126,7 @@ class TestMessagePost(TestMailCommon, TestRecipients):
with self.mock_mail_gateway():
msg = self.test_record.with_user(self.user_employee).message_post(
body='Test', subject='Test',
- message_type='comment', subtype='mt_comment',
+ message_type='comment', subtype_xmlid='mail.mt_comment',
attachment_ids=[_attach_1.id, _attach_2.id],
partner_ids=[self.partner_1.id],
attachments=_attachments,
@@ -155,7 +155,7 @@ class TestMessagePost(TestMailCommon, TestRecipients):
with self.mock_mail_gateway():
parent_msg = self.test_record.with_user(self.user_employee).message_post(
body='Test
', subject='Test Subject', - message_type='comment', subtype='mt_comment') + message_type='comment', subtype_xmlid='mail.mt_comment') self.assertEqual(parent_msg.partner_ids, self.env['res.partner']) self.assertNotSentEmail() @@ -163,7 +163,7 @@ class TestMessagePost(TestMailCommon, TestRecipients): with self.assertPostNotifications([{'content': 'Test Answer
', 'notif': [{'partner': self.partner_1, 'type': 'email'}]}]): msg = self.test_record.with_user(self.user_employee).message_post( body='Test Answer
', - message_type='comment', subtype='mt_comment', + message_type='comment', subtype_xmlid='mail.mt_comment', partner_ids=[self.partner_1.id], parent_id=parent_msg.id) @@ -177,7 +177,7 @@ class TestMessagePost(TestMailCommon, TestRecipients): new_msg = self.test_record.with_user(self.user_employee).message_post( body='Test Answer Bis
', - message_type='comment', subtype='mt_comment', + message_type='comment', subtype_xmlid='mail.mt_comment', parent_id=msg.id) self.assertEqual(new_msg.parent_id.id, parent_msg.id, 'message_post: flatten error') @@ -193,7 +193,7 @@ class TestMessagePost(TestMailCommon, TestRecipients): ]), patch.object(MailTestSimple, 'check_access_rights', return_value=True): new_msg = self.test_record.with_user(self.user_portal).message_post( body='Test
', subject='Subject', - message_type='comment', subtype='mt_comment') + message_type='comment', subtype_xmlid='mail.mt_comment') self.assertEqual(new_msg.sudo().notified_partner_ids, (self.partner_1 | self.user_employee.partner_id)) @@ -201,14 +201,14 @@ class TestMessagePost(TestMailCommon, TestRecipients): with self.assertRaises(AccessError): self.test_record.with_user(self.user_portal).message_post( body='Test
', subject='Subject', - message_type='comment', subtype='mt_comment') + message_type='comment', subtype_xmlid='mail.mt_comment') @mute_logger('odoo.addons.mail.models.mail_mail', 'odoo.addons.mail.models.mail_thread') def test_post_internal(self): self.test_record.message_subscribe([self.user_admin.partner_id.id]) msg = self.test_record.with_user(self.user_employee).message_post( body='My Body', subject='My Subject', - message_type='comment', subtype='mt_note') + message_type='comment', subtype_xmlid='mail.mt_note') self.assertEqual(msg.partner_ids, self.env['res.partner']) self.assertEqual(msg.notified_partner_ids, self.env['res.partner']) diff --git a/addons/test_mail/tests/test_odoobot.py b/addons/test_mail/tests/test_odoobot.py index 7766b5244dc..740a0444974 100644 --- a/addons/test_mail/tests/test_odoobot.py +++ b/addons/test_mail/tests/test_odoobot.py @@ -22,7 +22,7 @@ class TestOdoobot(TestMailCommon, TestRecipients): 'attachment_ids': [], 'message_type': 'comment', 'partner_ids': [], - 'subtype': 'mail.mt_comment' + 'subtype_xmlid': 'mail.mt_comment' } cls.odoobot_ping_body = '@OdooBot' % (cls.odoobot.id, cls.odoobot.id) cls.test_record_employe = cls.test_record.with_user(cls.user_employee) diff --git a/addons/test_mail/tests/test_performance.py b/addons/test_mail/tests/test_performance.py index b7948c23a4b..cf9852d6454 100644 --- a/addons/test_mail/tests/test_performance.py +++ b/addons/test_mail/tests/test_performance.py @@ -331,7 +331,7 @@ class TestMailAPIPerformance(BaseMailPerformance): with self.assertQueryCount(__system__=5, emp=6): record.message_post( body='Test message_post as log
', - subtype='mail.mt_note', + subtype_xmlid='mail.mt_note', message_type='comment') @users('__system__', 'emp') @@ -344,7 +344,7 @@ class TestMailAPIPerformance(BaseMailPerformance): body='Test Post Performances basic
', partner_ids=[], message_type='comment', - subtype='mail.mt_comment') + subtype_xmlid='mail.mt_comment') @mute_logger('odoo.addons.mail.models.mail_mail', 'odoo.models.unlink') @users('__system__', 'emp') @@ -357,7 +357,7 @@ class TestMailAPIPerformance(BaseMailPerformance): body='Test Post Performances with an email ping
', partner_ids=self.customer.ids, message_type='comment', - subtype='mail.mt_comment') + subtype_xmlid='mail.mt_comment') @users('__system__', 'emp') @warmup @@ -369,7 +369,7 @@ class TestMailAPIPerformance(BaseMailPerformance): body='Test Post Performances with an inbox ping
', partner_ids=self.user_test.partner_id.ids, message_type='comment', - subtype='mail.mt_comment') + subtype_xmlid='mail.mt_comment') @mute_logger('odoo.models.unlink') @users('__system__', 'emp') @@ -476,7 +476,7 @@ class TestMailComplexPerformance(BaseMailPerformance): record.message_post( body='Test Post Performances
', message_type='comment', - subtype='mail.mt_comment') + subtype_xmlid='mail.mt_comment') self.assertEqual(record.message_ids[0].body, 'Test Post Performances
') self.assertEqual(record.message_ids[0].notified_partner_ids, self.partners | self.user_portal.partner_id) @@ -823,7 +823,7 @@ class TestMailHeavyPerformancePost(BaseMailPerformance): body='Test body