diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index 62f0f524ebf2a1eb8fc5030624c7dadac7aae628..01bc5e71a5aa4e044bcb21134d673ef3d9de9c42 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -411,7 +411,6 @@ class Message(models.Model): 'message_type', 'subtype_id', 'subject', # message specific 'model', 'res_id', 'record_name', # document related 'channel_ids', 'partner_ids', # recipients - 'needaction_partner_ids', # list of partner ids for whom the message is a needaction 'starred_partner_ids', # list of partner ids for whom the message is starred ]) message_tree = dict((m.id, m) for m in self.sudo()) @@ -423,6 +422,7 @@ class Message(models.Model): subtypes = self.env['mail.message.subtype'].sudo().browse(subtype_ids).read(['internal', 'description']) subtypes_dict = dict((subtype['id'], subtype) for subtype in subtypes) for message in message_values: + message['needaction_partner_ids'] = self.env['mail.notification'].sudo().search([('mail_message_id', '=', message['id']), ('is_read', '=', False)]).mapped('res_partner_id').ids message['is_note'] = message['subtype_id'] and subtypes_dict[message['subtype_id'][0]]['internal'] message['subtype_description'] = message['subtype_id'] and subtypes_dict[message['subtype_id'][0]]['description'] if message['model'] and self.env[message['model']]._original_module: diff --git a/odoo/addons/test_performance/tests/test_performance.py b/odoo/addons/test_performance/tests/test_performance.py index ef4089a8fdcd6f32cd6c1dc2839649bf5652482c..d05c006d4517a8dd8109b94144bc552a3072497d 100644 --- a/odoo/addons/test_performance/tests/test_performance.py +++ b/odoo/addons/test_performance/tests/test_performance.py @@ -141,7 +141,7 @@ class TestPerformance(TransactionCase): records.write({'value': self.int(20)}) - @queryCount(admin=33, demo=47) + @queryCount(admin=35, demo=47) def test_write_mail_with_tracking(self): """ Write records inheriting from 'mail.thread' (with field tracking). """ record = self.env['test_performance.mail'].search([], limit=1) @@ -180,7 +180,7 @@ class TestPerformance(TransactionCase): model = self.env['test_performance.mail'] model.with_context(tracking_disable=True).create({'name': self.str('X')}) - @queryCount(admin=63, demo=85) + @queryCount(admin=67, demo=85) def test_create_mail_with_tracking(self): """ Create records inheriting from 'mail.thread' (with field tracking). """ model = self.env['test_performance.mail']