This commit allows to take domain into account for custom activity groups in the systray. Steps ===== In debug mode: - Install module mass_mailing_sms - Add an activity for a mailing.mailing record with mailing_type set to 'sms' (i.e. a record visible in the SMS Marketing app). - Add an activity for a mailing.mailing record with mailing_type != 'sms' (i.e. a record visible in the Email Marketing app). - Open the activity menu Not in debug mode: - Do the same step as above - Click on the category "SMS Marketing" in the activity menu Issue ===== - In debug mode: a traceback will pop up when the activity menu is opened with an error message similar to `Got duplicate key in t-foreach: 1182`. - Not in debug mode: when clicking on the SMS Marketing category in the activity menu, all records of model mailing.mailing with activities set will be displayed and not only the one with mailing_type set to 'sms'. Cause ===== - In the method systray_get_activities, the id of each model is used to create groups of activities. In mass_mailing_sms, the same logic is used but two groups are created for the model mailing.mailing, thus with the same id. This create a traceback in debug mode when displaying the activity menu are the id of the groups are used as key for a foreach in the view template. - The methods openActivityGroup and onClickAction called when the user click on an activity group (or on the activity icon next to it) do not take the domain of the group into account correctly. Fix === - The id key of activity groups is renamed in sequence - The value of sequence is only used to sort activity groups on the client side - group_index is used as t-key value in the template of the activity menu - The domain of each group (if any) is combined with the domains used in openActivityGroup and onClickAction closes odoo/odoo#132402 X-original-commit: 1f154b4ba21e34c9021f07c5e62d8de460eb824e Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
40 lines
1.7 KiB
Python
40 lines
1.7 KiB
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo.tests import HttpCase, tagged, users
|
|
|
|
|
|
@tagged('post_install', '-at_install', 'mail_activity')
|
|
class TestMailingUi(HttpCase):
|
|
|
|
@users('admin')
|
|
def test_tour_mailing_activities_split(self):
|
|
""" Activities linked to mailing.mailing records can appear either in the
|
|
'Email Marketing', either in the 'SMS Marketing' category, depending on
|
|
the value of the field mailing_type of the record it is linked to. This
|
|
test ensures that:
|
|
- activities linked to records with mailing_type set to mail are listed
|
|
in the 'Email Marketing' category
|
|
- activities linked to records with mailing_type set to sms are listed
|
|
in the 'SMS Marketing' category
|
|
"""
|
|
sms_rec, email_rec = self.env['mailing.mailing'].create([
|
|
{
|
|
'body_plaintext': 'Some sms spam',
|
|
'mailing_type': 'sms',
|
|
'name': 'SMS record with an activity',
|
|
'subject': 'New SMS!',
|
|
}, {
|
|
'body_html': '<p>Some email spam</p>',
|
|
'mailing_type': 'mail',
|
|
'name': 'Email record with an activity',
|
|
'subject': 'New Email!',
|
|
}
|
|
])
|
|
|
|
sms_rec.activity_schedule(act_type_xmlid='mail.mail_activity_data_todo')
|
|
email_rec.activity_schedule(act_type_xmlid='mail.mail_activity_data_todo')
|
|
|
|
# Ensure that both activities appear in the systray and that clicking on
|
|
# one activity opens a view where the other activity isn't listed
|
|
self.start_tour("/web", 'mailing_activities_split', login="admin")
|