- In the campaign form view, when you click on "SMS", the filter has changed ``My Mailing`` -> ``My SMS Marketing`` - In the campaign form view, display the Mail/SMS subject instead of the SMS name - In UTM, move the campaign from the data to the demo data Task #2082296 closes odoo/odoo#40205 Related: odoo/enterprise#6685 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
43 lines
1.5 KiB
Python
43 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class UtmCampaign(models.Model):
|
|
_inherit = 'utm.campaign'
|
|
|
|
mailing_sms_ids = fields.One2many(
|
|
'mailing.mailing', 'campaign_id',
|
|
domain=[('mailing_type', '=', 'sms')],
|
|
string='Mass SMS')
|
|
mailing_sms_count = fields.Integer('Number of Mass SMS', compute="_compute_mailing_sms_count")
|
|
|
|
@api.depends('mailing_sms_ids')
|
|
def _compute_mailing_sms_count(self):
|
|
for campaign in self:
|
|
campaign.mailing_sms_count = len(campaign.mailing_sms_ids)
|
|
|
|
def action_create_mass_sms(self):
|
|
action = self.env.ref('mass_mailing.action_create_mass_mailings_from_campaign').read()[0]
|
|
action['context'] = {
|
|
'default_campaign_id': self.id,
|
|
'default_mailing_type': 'sms',
|
|
'search_default_assigned_to_me': 1,
|
|
'search_default_campaign_id': self.id,
|
|
'default_user_id': self.env.user.id,
|
|
}
|
|
return action
|
|
|
|
def action_redirect_to_mailing_sms(self):
|
|
action = self.env.ref('mass_mailing_sms.mailing_mailing_action_sms').read()[0]
|
|
action['context'] = {
|
|
'default_campaign_id': self.id,
|
|
'default_mailing_type': 'sms',
|
|
'search_default_assigned_to_me': 1,
|
|
'search_default_campaign_id': self.id,
|
|
'default_user_id': self.env.user.id,
|
|
}
|
|
action['domain'] = [('mailing_type', '=', 'sms')]
|
|
return action
|