[FIX] mail: performance, replace filter() by condition in domain
This commit is contained in:
@@ -802,8 +802,9 @@ class Message(models.Model):
|
||||
if self_sudo.subtype_id and self.model and self.res_id:
|
||||
followers = self.env['mail.followers'].sudo().search([
|
||||
('res_model', '=', self.model),
|
||||
('res_id', '=', self.res_id)
|
||||
]).filtered(lambda fol: self.subtype_id in fol.subtype_ids)
|
||||
('res_id', '=', self.res_id),
|
||||
('subtype_ids', 'in', self_sudo.subtype_id.id),
|
||||
])
|
||||
if self_sudo.subtype_id.internal:
|
||||
followers = followers.filtered(lambda fol: fol.channel_id or (fol.partner_id.user_ids and group_user in fol.partner_id.user_ids[0].mapped('groups_id')))
|
||||
channels_sudo |= followers.mapped('channel_id')
|
||||
|
||||
@@ -141,7 +141,7 @@ class TestPerformance(TransactionCase):
|
||||
|
||||
records.write({'value': self.int(20)})
|
||||
|
||||
@queryCount(admin=44, demo=61)
|
||||
@queryCount(admin=42, demo=59)
|
||||
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=85, demo=111)
|
||||
@queryCount(admin=81, demo=107)
|
||||
def test_create_mail_with_tracking(self):
|
||||
""" Create records inheriting from 'mail.thread' (with field tracking). """
|
||||
model = self.env['test_performance.mail']
|
||||
|
||||
Reference in New Issue
Block a user