[IMP] mail: reduce message_post query count and clean code

Purpose of this commit is to improve performance of post and notify through
various code improvements.

Containing
  * making of _notify_customize_recipients a mail.thread method;
  * _message_auto_subscribe_followers optimized;
  * renaming and optimisation of _notify_partners;
  * message_post_attachements optization;
  * remove unused mail_post_autofollow_partner_ids context key;
  * minimize message create queries;
  * only check record related access right for thread messages not in pending
    moderation;
  * get attachements from values instead of db;
  * storing lang in ctx from the beginning;
  * don't track on write on attachments;

Related to task 1943901
Linked to PR #32404
This commit is contained in:
Xavier-Do
2019-05-29 13:34:32 +00:00
committed by Thibault Delavallée
parent 2fcb3c658d
commit de7c119e66
12 changed files with 363 additions and 277 deletions
@@ -218,6 +218,7 @@ class TestMessagePost(BaseFunctionalTest, MockEmails, TestRecipients):
self.assertEqual(new_notification.email_from, formataddr((self.env.user.name, self.env.user.email)))
self.assertEqual(new_notification.needaction_partner_ids, self.partner_1 | self.user_employee.partner_id)
self.assertNotIn(new_notification, self.test_record.message_ids)
# todo xdo add test message_notify on thread with followers and stuff
class TestComposer(BaseFunctionalTest, MockEmails, TestRecipients):