diff options
| author | Thibault Delavallée <tde@odoo.com> | 2020-01-13 13:11:59 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-03-03 16:25:01 +0000 |
| commit | 48d884678cc57ac3d3d350ceb13a208e921f9046 (patch) | |
| tree | 1ebf1eaefe0ded9b53d5430795be5da2afbae8fa /addons/test_mail | |
| parent | 68a457e17491ac90e3b806178eefc4b7150d176b (diff) | |
[FIX] mail: route only to other models when routing a forward
When mailgateway receives an incoming email being a reply to a thread but
containing a recipient being an alias linked to another model, it is
considered as a forward to that new alias. It therefore skips the reply
step in routing and applies rules related to new thread, aka checking
all recipients.
Consider this use case: receives a email on a task from "project@domain"
project being the alias of the project which creates new tasks when not
routing replies. Reply / forward it to "project@domain, sales@domain" in
order to transfer it to the sales team (sales alias creates new leads).
As this is a forward, both aliases are evaluated, leading to a new task and a
lead which is not what we expect.
We solve this issue by removing alias linked to the ignored reply model
when considering recipients.
PR #46764
Task ID 2121551
closes odoo/odoo#46784
X-original-commit: 7cff7787cb42cc9d3d0cb4c5af41a9f09d59d1ff
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/test_mail')
| -rw-r--r-- | addons/test_mail/tests/test_mail_gateway.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/addons/test_mail/tests/test_mail_gateway.py b/addons/test_mail/tests/test_mail_gateway.py index 52e2e15eb5d..698ba38264a 100644 --- a/addons/test_mail/tests/test_mail_gateway.py +++ b/addons/test_mail/tests/test_mail_gateway.py @@ -431,9 +431,8 @@ class TestMailgateway(TestMailCommon): self.assertEqual(new_rec._name, new_alias_2.alias_model_id.model) # No new post on test_record, no new record in mail.test.simple either self.assertEqual(len(self.test_record.message_ids), 1, 'message_process: should not post on replied record as forward should bypass it') - # TDE FIXME: if forward, all alias are applied, should probably not - # new_simple = self.env['mail.test.simple'].search([('name', '=', 'Test Subject')]) - # self.assertEqual(len(new_simple), 0, 'message_process: a new mail.test should not have been created') + new_simple = self.env['mail.test.simple'].search([('name', '=', 'Test Subject')]) + self.assertEqual(len(new_simple), 0, 'message_process: a new mail.test should not have been created') @mute_logger('odoo.addons.mail.models.mail_thread', 'odoo.models') def test_message_route_alias_forward_bypass_reply_second(self): @@ -459,9 +458,8 @@ class TestMailgateway(TestMailCommon): self.assertEqual(new_rec._name, new_alias_2.alias_model_id.model) # No new post on test_record, no new record in mail.test.simple either self.assertEqual(len(self.test_record.message_ids), 1, 'message_process: should not post on replied record as forward should bypass it') - # TDE FIXME: if forward, all alias are applied, should probably not - # new_simple = self.env['mail.test.simple'].search([('name', '=', 'Test Subject')]) - # self.assertEqual(len(new_simple), 0, 'message_process: a new mail.test should not have been created') + new_simple = self.env['mail.test.simple'].search([('name', '=', 'Test Subject')]) + self.assertEqual(len(new_simple), 0, 'message_process: a new mail.test should not have been created') @mute_logger('odoo.addons.mail.models.mail_thread', 'odoo.models') def test_message_route_alias_forward_bypass_update_alias(self): @@ -488,8 +486,8 @@ class TestMailgateway(TestMailCommon): # Forward created a new record in mail.test self.assertEqual(len(new_rec), 1, 'message_process: a new mail.test should have been created') self.assertEqual(new_rec._name, new_alias_2.alias_model_id.model) - # TDE FIXME No new post on test_record, no new record in mail.test.simple either - # self.assertEqual(len(self.test_record.message_ids), 1, 'message_process: should not post on replied record as forward should bypass it') + # No new post on test_record, no new record in mail.test.simple either + self.assertEqual(len(self.test_record.message_ids), 1, 'message_process: should not post on replied record as forward should bypass it') # No new record on first alias model new_simple = self.env['mail.test.gateway'].search([('name', '=', 'Test Subject')]) self.assertEqual(len(new_simple), 0, 'message_process: a new mail.test should not have been created') |
