diff options
| author | Sébastien Theys <seb@odoo.com> | 2020-03-06 10:34:00 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-03-06 16:15:43 +0000 |
| commit | ad5454f0ef285c304590a6f7aae9f0634f280ae7 (patch) | |
| tree | 640dca0cc95536bcd1978d4657f50c3cd2f65a7c /addons/test_mail | |
| parent | b9e1f0d700d024ffefeaefb8aaedcb9bae04354b (diff) | |
[IMP] mail, test_mail: simplify attachment
in `_message_read_dict_postprocess`.
This makes the method easier to follow and does not increase the query count.
It actually reduces it when the attachment data were already in the cache, by
not always reading them again.
The `has_access_to_model` is removed and replaced by `sudo` because:
- from portal everything is sudo so it's pointless to check access on top of it
- from backend, it's almost impossible to trigger the case, and it's not like
returning is_main True would leak any sensitive information to an employee
Part of task-2180311
PR: #43841
Diffstat (limited to 'addons/test_mail')
| -rw-r--r-- | addons/test_mail/tests/test_performance.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/test_mail/tests/test_performance.py b/addons/test_mail/tests/test_performance.py index f7da7907891..fcf52bae9f3 100644 --- a/addons/test_mail/tests/test_performance.py +++ b/addons/test_mail/tests/test_performance.py @@ -794,7 +794,7 @@ class TestMailComplexPerformance(BaseMailPerformance): ] }]) - with self.assertQueryCount(emp=13): + with self.assertQueryCount(emp=12): res = messages.message_format() self.assertEqual(len(res), 2) for message in res: @@ -928,7 +928,7 @@ class TestMailHeavyPerformancePost(BaseMailPerformance): ] self.attachements = self.env['ir.attachment'].with_user(self.env.user).create(self.vals) attachement_ids = self.attachements.ids - with self.assertQueryCount(emp=91): + with self.assertQueryCount(emp=90): self.cr.sql_log = self.warm and self.cr.sql_log_count record.with_context({}).message_post( body='<p>Test body <img src="cid:cid1"> <img src="cid:cid2"></p>', |
