From 3eeedd29616682919215f4bdb75690a7d793635e Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Wed, 4 Mar 2020 08:24:08 +0000 Subject: [PATCH] [FIX] test_mail: test for conflicting partner_id on subscribe From opw-2200219 opw-2210285 (v12) Use case (2200219): - Install CRM, sales and Automated Action - Create the automated action * Model -> Sale Order * Trigger Condition -> On creation * Action To Do -> Add followers * Add Channels -> sales - Create a new CRM opportunity with a partner set, Save - Click on the "New quotation" - Save A Traceback "Error: A follower must be either a partner or a channel (but not both)." will popup, blocking the user from completing the action. Use case (2210285): After adding a channel as a follower to a sales team it is not possible to create a sale order from a contact or opportunity. You can only create a sale order from the sales app in that case. End of use cases----- This occur because the context flag default_partner_id is used by the model to override the empty partner_id which should remain empty Fixed in v12, forwarding the test for v13 and upward closes odoo/odoo#48476 X-original-commit: 049aa5c2297938bcd378d1dee1aa766a646cb461 Signed-off-by: Nicolas Martinelli (nim) --- addons/test_mail/tests/test_mail_followers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/test_mail/tests/test_mail_followers.py b/addons/test_mail/tests/test_mail_followers.py index 1e1597334d5..9b9682d3b13 100644 --- a/addons/test_mail/tests/test_mail_followers.py +++ b/addons/test_mail/tests/test_mail_followers.py @@ -117,6 +117,16 @@ class BaseFollowersTest(TestMailCommon): 'channel_id': self.channel_listen.id, }) + def test_followers_default_partner_context(self): + """Test that a follower partner_id is not taken from context + when channel id is also defined. + """ + test_record = self.test_record.with_user(self.user_employee) + test_record.with_context(default_partner_id=1).message_subscribe( + partner_ids=[self.user_employee.partner_id.id, self.user_admin.partner_id.id], + channel_ids=[self.channel_listen.id] + ) + class AdvancedFollowersTest(TestMailCommon): @classmethod