From 074a91a300b4bbf71affe0339b0dc7f1c02d5cee Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 12 Jun 2023 06:46:11 +0000 Subject: [PATCH] [FIX] test_mail: mutlicompany systray test odoo/odoo#122354 added this test but didn't handle that other models might trigger systray activities. On June 12th, the test started failing because calendar has a "Pricing Discussion" demo calendar event on the 12th of every month. It probably would have also failed on the 3rd and 22nd which both have demo meetings for the admin. Fix by looking up specifically activities of the test model we're concerned with. closes odoo/odoo#124684 X-original-commit: 54dce61ef8fa97e18f0cf53d1f098af55e1210e9 Signed-off-by: Xavier Morel (xmo) --- addons/test_mail/tests/test_mail_multicompany.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/addons/test_mail/tests/test_mail_multicompany.py b/addons/test_mail/tests/test_mail_multicompany.py index e62db1746e4..0a924acf763 100644 --- a/addons/test_mail/tests/test_mail_multicompany.py +++ b/addons/test_mail/tests/test_mail_multicompany.py @@ -394,9 +394,12 @@ class TestMultiCompanySetup(MailCommon, TestRecipients): ) test_records[0].activity_schedule("test_mail.mail_act_test_todo", user_id=user_admin.id) test_records[1].activity_schedule("test_mail.mail_act_test_todo", user_id=user_admin.id) - res_all = user_admin.systray_get_activities() + test_activity = next( + a for a in user_admin.systray_get_activities() + if a['model'] == 'mail.test.multi.company.with.activity' + ) self.assertEqual( - res_all[0], + test_activity, { "actions": [{"icon": "fa-clock-o", "name": "Summary"}], "icon": "/base/static/description/icon.png", @@ -410,9 +413,13 @@ class TestMultiCompanySetup(MailCommon, TestRecipients): "type": "activity", } ) - res_c2 = user_admin.with_context(allowed_company_ids=[self.company_2.id]).systray_get_activities() + + test_activity = next( + a for a in user_admin.with_context(allowed_company_ids=[self.company_2.id]).systray_get_activities() + if a['model'] == 'mail.test.multi.company.with.activity' + ) self.assertEqual( - res_c2[0], + test_activity, { "actions": [{"icon": "fa-clock-o", "name": "Summary"}], "icon": "/base/static/description/icon.png",