diff options
| author | Alexandre Kühn <aku@odoo.com> | 2020-01-09 11:30:24 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2020-01-10 10:17:09 +0000 |
| commit | 5a13364506e744ebcbe282d3967e987a5036d8cd (patch) | |
| tree | dbfa9da915e5396a24b83e79f2779767a487aae1 /addons/test_mail | |
| parent | a50cefb76990f389a1c0317b9356ac9c2f3f40f3 (diff) | |
[FIX] mail: mark all messages as read in discuss inbox
Revision on https://github.com/odoo/odoo/commit/a55c78836f172dba1cfa6db3df0e927a9c7e6471
Before this commit, marking all messages as read from Discuss inbox
did not update the UI correctly, hence requiring a page reload.
This bug comes from a typo in the commit above, which passed a list
of mail_notification instead of message ids, so that messages were
handled as marked as read by the web client.
Task-Id 2158452
closes odoo/odoo#43109
X-original-commit: 3cc03ee3db90c310dc60fe7ea18e0e6abe741ffa
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/test_mail')
| -rw-r--r-- | addons/test_mail/tests/test_mail_message.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/addons/test_mail/tests/test_mail_message.py b/addons/test_mail/tests/test_mail_message.py index 4f08f0abc18..2ff5c6f7d5f 100644 --- a/addons/test_mail/tests/test_mail_message.py +++ b/addons/test_mail/tests/test_mail_message.py @@ -360,17 +360,19 @@ 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_xmlid='mail.mt_comment', partner_ids=[emp_partner.id]) + msg1 = group_private.message_post(body='Test', message_type='comment', subtype_xmlid='mail.mt_comment', partner_ids=[emp_partner.id]) + self._reset_bus() emp_partner.env['mail.message'].mark_all_as_read(domain=[]) + self.assertBusNotifications([(self.cr.dbname, 'res.partner', emp_partner.id)], [{ 'type': 'mark_as_read', 'message_ids': [msg1.id] }]) 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_xmlid='mail.mt_comment', partner_ids=[emp_partner.id]) + msg2 = 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") - new_msg.sudo().partner_ids = self.env['res.partner'] + msg2.sudo().partner_ids = self.env['res.partner'] emp_partner.env['mail.message'].search([['needaction', '=', True]]) needaction_length = len(emp_partner.env['mail.message'].search([['needaction', '=', True]])) self.assertEqual(needaction_length, 1, "message should still be readable when notified") @@ -378,7 +380,9 @@ class TestMessageAccess(TestMailCommon): na_count = emp_partner.get_needaction_count() self.assertEqual(na_count, 1, "message not accessible is currently still counted") + self._reset_bus() emp_partner.env['mail.message'].mark_all_as_read(domain=[]) + self.assertBusNotifications([(self.cr.dbname, 'res.partner', emp_partner.id)], [{ 'type': 'mark_as_read', 'message_ids': [msg2.id] }]) na_count = emp_partner.get_needaction_count() self.assertEqual(na_count, 0, "mark all read should conclude all needactions even inacessible ones") |
