[FIX] mass_mailing{_sms}: respect mailing_type when comparing a/b mailings
Before this commit
- When we were comparing versions, there was no such filter as
mailing type. Due to this it will display both SMS and mail
type records in it.
With this commit
- We have added '('mailing_type', '=', self.mailing_type)' in domain
of compare version.
TaskId-2713198
X-original-commit: e8542e24597ad25b68104c03d4d4ed41e1efac82
Part-of: odoo/odoo#107488
This commit is contained in:
committed by
Aurélien Warnon
parent
91a223bd52
commit
6bfe126313
@@ -793,7 +793,7 @@ class MassMailing(models.Model):
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'tree,kanban,form,calendar,graph',
|
||||
'res_model': 'mailing.mailing',
|
||||
'domain': [('campaign_id', '=', self.campaign_id.id), ('ab_testing_enabled', '=', True)],
|
||||
'domain': [('campaign_id', '=', self.campaign_id.id), ('ab_testing_enabled', '=', True), ('mailing_type', '=', self.mailing_type)],
|
||||
}
|
||||
if self.mailing_type == 'mail':
|
||||
action['views'] = [
|
||||
|
||||
@@ -132,6 +132,16 @@ class TestMailingABTesting(MassMailCommon):
|
||||
self.assertTrue(ab_mailing.ab_testing_winner_selection, "The selection winner has been set to default value")
|
||||
self.assertTrue(ab_mailing.ab_testing_schedule_datetime, "The schedule date has been set to default value")
|
||||
|
||||
@users('user_marketing')
|
||||
def test_mailing_ab_testing_compare(self):
|
||||
# compare version feature should returns all mailings of the same
|
||||
# campaign having a/b testing enabled.
|
||||
compare_version = self.ab_testing_mailing_1.action_compare_versions()
|
||||
self.assertEqual(
|
||||
self.env['mailing.mailing'].search(compare_version.get('domain')),
|
||||
self.ab_testing_mailing_1 + self.ab_testing_mailing_2
|
||||
)
|
||||
|
||||
@mute_logger('odoo.addons.mail.models.mail_mail')
|
||||
@users('user_marketing')
|
||||
def test_mailing_ab_testing_manual_flow(self):
|
||||
|
||||
@@ -4,3 +4,4 @@
|
||||
from . import common
|
||||
from . import test_mailing_internals
|
||||
from . import test_mailing_retry
|
||||
from . import test_mailing_sms_ab_testing
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from odoo.addons.mass_mailing_sms.tests.common import MassSMSCommon
|
||||
from odoo.addons.mass_mailing.tests.test_mailing_ab_testing import TestMailingABTesting
|
||||
from odoo.tests import tagged
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestMailingSMSABTesting(MassSMSCommon, TestMailingABTesting):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.ab_testing_mailing_sms_1 = self.env['mailing.mailing'].create({
|
||||
'subject': 'A/B Testing SMS V1',
|
||||
'contact_list_ids': self.mailing_list.ids,
|
||||
'ab_testing_enabled': True,
|
||||
'ab_testing_pc': 10,
|
||||
'ab_testing_schedule_datetime': datetime.now(),
|
||||
'mailing_type': 'sms'
|
||||
})
|
||||
self.ab_testing_mailing_sms_2 = self.ab_testing_mailing_sms_1.copy({
|
||||
'subject': 'A/B Testing SMS V2',
|
||||
'ab_testing_pc': 20,
|
||||
})
|
||||
|
||||
def test_mailing_sms_ab_testing_compare(self):
|
||||
# compare version feature should returns all mailings of the same
|
||||
# campaign having a/b testing enabled and of mailing_type 'sms'.
|
||||
compare_version = self.ab_testing_mailing_sms_1.action_compare_versions()
|
||||
self.assertEqual(
|
||||
self.env['mailing.mailing'].search(compare_version.get('domain')),
|
||||
self.ab_testing_mailing_sms_1 + self.ab_testing_mailing_sms_2
|
||||
)
|
||||
Reference in New Issue
Block a user