[MERGE] marketing_automation: New marketing campaign yeay!!!!
This commit is contained in:
@@ -51,7 +51,6 @@ class Lead(models.Model):
|
||||
_description = "Lead/Opportunity"
|
||||
_order = "priority desc,activity_date_deadline,id desc"
|
||||
_inherit = ['mail.thread', 'mail.activity.mixin', 'utm.mixin', 'format.address.mixin']
|
||||
_mail_mass_mailing = _('Leads / Opportunities')
|
||||
|
||||
def _default_probability(self):
|
||||
stage_id = self._default_stage_id()
|
||||
|
||||
@@ -319,12 +319,12 @@ class EventEvent(models.Model):
|
||||
def _is_event_registrable(self):
|
||||
return True
|
||||
|
||||
|
||||
class EventRegistration(models.Model):
|
||||
_name = 'event.registration'
|
||||
_description = 'Attendee'
|
||||
_inherit = ['mail.thread']
|
||||
_order = 'name, create_date desc'
|
||||
_mail_mass_mailing = _('Event Attendees')
|
||||
|
||||
origin = fields.Char(
|
||||
string='Source Document', readonly=True,
|
||||
|
||||
@@ -89,7 +89,6 @@ class Applicant(models.Model):
|
||||
_description = "Applicant"
|
||||
_order = "priority desc, id desc"
|
||||
_inherit = ['mail.thread', 'mail.activity.mixin', 'utm.mixin']
|
||||
_mail_mass_mailing = _('Applicants')
|
||||
|
||||
def _default_stage_id(self):
|
||||
if self._context.get('default_job_id'):
|
||||
|
||||
@@ -244,23 +244,21 @@ class link_tracker_click(models.Model):
|
||||
again = self.search_count([('link_id', '=', code_rec.link_id.id), ('ip', '=', ip)])
|
||||
|
||||
if not again:
|
||||
country_record = self.env['res.country'].search([('code', '=', country_code)], limit=1)
|
||||
self.create(
|
||||
self._get_click_values(dict(
|
||||
code=code,
|
||||
ip=ip,
|
||||
country_code=country_code,
|
||||
stat_id=stat_id,
|
||||
)))
|
||||
|
||||
vals = {
|
||||
'link_id': code_rec.link_id.id,
|
||||
'create_date': datetime.date.today(),
|
||||
'ip': ip,
|
||||
'country_id': country_record.id,
|
||||
'mail_stat_id': stat_id
|
||||
}
|
||||
def _get_click_values_from_route(self, route_values):
|
||||
code = self.env['link.tracker.code'].search([('code', '=', route_values['code'])], limit=1)
|
||||
country = self.env['res.country'].search([('code', '=', route_values['country_code'])], limit=1)
|
||||
|
||||
if stat_id:
|
||||
mail_stat = self.env['mail.mail.statistics'].search([('id', '=', stat_id)])
|
||||
|
||||
if mail_stat.mass_mailing_campaign_id:
|
||||
vals['mass_mailing_campaign_id'] = mail_stat.mass_mailing_campaign_id.id
|
||||
|
||||
if mail_stat.mass_mailing_id:
|
||||
vals['mass_mailing_id'] = mail_stat.mass_mailing_id.id
|
||||
|
||||
self.create(vals)
|
||||
return {
|
||||
'link_id': code.link_id.id,
|
||||
'create_date': datetime.date.today(),
|
||||
'ip': route_values['ip'],
|
||||
'country_id': country.id,
|
||||
}
|
||||
|
||||
@@ -79,7 +79,6 @@ class MailThread(models.AbstractModel):
|
||||
_description = 'Email Thread'
|
||||
_mail_flat_thread = True # flatten the discussino history
|
||||
_mail_post_access = 'write' # access required on the document to post on it
|
||||
_mail_mass_mailing = False # enable mass mailing on this model
|
||||
_Attachment = namedtuple('Attachment', ('fname', 'content', 'info'))
|
||||
|
||||
message_is_follower = fields.Boolean(
|
||||
@@ -2201,13 +2200,3 @@ class MailThread(models.AbstractModel):
|
||||
msg_comment.write({"res_id": new_thread.id, "model": new_thread._name})
|
||||
msg_not_comment.write({"res_id": new_thread.id, "model": new_thread._name, "subtype_id": None})
|
||||
return True
|
||||
|
||||
# ------------------------------------------------------
|
||||
# Mass mailing
|
||||
# ------------------------------------------------------
|
||||
|
||||
def message_mass_mailing_enabled(self):
|
||||
if self._mail_mass_mailing:
|
||||
# TODO master properly translate
|
||||
# the _mail_mass_mailing is evaluted at code start so not translated
|
||||
return _(self._mail_mass_mailing)
|
||||
|
||||
@@ -18,7 +18,6 @@ class Partner(models.Model):
|
||||
_name = "res.partner"
|
||||
_inherit = ['res.partner', 'mail.thread', 'mail.activity.mixin']
|
||||
_mail_flat_thread = False
|
||||
_mail_mass_mailing = _('Customers')
|
||||
|
||||
message_bounce = fields.Integer('Bounce', help="Counter of the number of bounced emails for this contact", default=0)
|
||||
opt_out = fields.Boolean(
|
||||
|
||||
@@ -35,6 +35,7 @@ access_mail_shortcode,mail.shortcode,model_mail_shortcode,base.group_user,1,1,1,
|
||||
access_mail_shortcode_portal,mail.shortcode.portal,model_mail_shortcode,base.group_portal,1,0,0,0
|
||||
access_mail_test_user,mail.test.all,model_mail_test,base.group_user,1,1,1,1
|
||||
access_mail_test_portal,mail.test.all,model_mail_test,base.group_portal,1,1,0,0
|
||||
access_mail_test_simple,mail.test.simple.all,model_mail_test_simple,base.group_user,1,1,1,1
|
||||
access_mail_activity_all,mail.activity.all,model_mail_activity,,1,0,0,0
|
||||
access_mail_activity_user,mail.activity.user,model_mail_activity,base.group_user,1,1,1,1
|
||||
access_mail_activity_type_all,mail.activity.type.all,model_mail_activity_type,,1,0,0,0
|
||||
|
||||
|
@@ -1,16 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class MailTestSimple(models.Model):
|
||||
_description = 'Test Simple Chatter Record'
|
||||
_name = 'mail.test.simple'
|
||||
_inherit = ['mail.thread']
|
||||
|
||||
name = fields.Char()
|
||||
email_from = fields.Char()
|
||||
description = fields.Text()
|
||||
|
||||
|
||||
class MailTest(models.Model):
|
||||
""" A mail.channel is a discussion group that may behave like a listener
|
||||
on documents. """
|
||||
_description = 'Test Mail Model'
|
||||
_name = 'mail.test'
|
||||
_mail_post_access = 'read'
|
||||
# _mail_flat_thread = False
|
||||
_inherit = ['mail.thread', 'mail.alias.mixin']
|
||||
|
||||
name = fields.Char()
|
||||
|
||||
@@ -17,7 +17,7 @@ class MassMailController(http.Controller):
|
||||
if mailing.exists():
|
||||
res_id = res_id and int(res_id)
|
||||
res_ids = []
|
||||
if mailing.mailing_model == 'mail.mass_mailing.contact':
|
||||
if mailing.mailing_model_name == 'mail.mass_mailing.contact':
|
||||
contacts = request.env['mail.mass_mailing.contact'].sudo().search([
|
||||
('email', '=', email),
|
||||
('list_id', 'in', [mailing_list.id for mailing_list in mailing.contact_list_ids])
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<field name="state">done</field>
|
||||
<field name="sent_date" eval="(DateTime.today() - relativedelta(days=5)).strftime('%Y-%m-%d %H:%M:%S')"/>
|
||||
<field name="mass_mailing_campaign_id" eval="ref('mass_mail_campaign_1')"/>
|
||||
<field name="mailing_model">res.partner</field>
|
||||
<field name="mailing_model_id" ref="base.model_res_partner"/>
|
||||
<field name="mailing_domain">[('customer', '=', True)]</field>
|
||||
<field name="reply_to_mode">email</field>
|
||||
<field name="reply_to"><![CDATA[Info <info@yourcompany.example.com>]]></field>
|
||||
@@ -77,7 +77,7 @@
|
||||
<field name="name">Second Newsletter</field>
|
||||
<field name="state">draft</field>
|
||||
<field name="mass_mailing_campaign_id" eval="ref('mass_mail_campaign_1')"/>
|
||||
<field name="mailing_model">res.partner</field>
|
||||
<field name="mailing_model_id" ref="base.model_res_partner"/>
|
||||
<field name="mailing_domain">[('customer', '=', True)]</field>
|
||||
<field name="reply_to_mode">email</field>
|
||||
<field name="reply_to"><![CDATA[Info <info@yourcompany.example.com>]]></field>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class LinkTracker(models.Model):
|
||||
@@ -17,3 +17,23 @@ class LinkTrackerClick(models.Model):
|
||||
mail_stat_id = fields.Many2one('mail.mail.statistics', string='Mail Statistics')
|
||||
mass_mailing_id = fields.Many2one('mail.mass_mailing', string='Mass Mailing')
|
||||
mass_mailing_campaign_id = fields.Many2one('mail.mass_mailing.campaign', string='Mass Mailing Campaign')
|
||||
|
||||
@api.model
|
||||
def add_click(self, code, ip, country_code, stat_id=False):
|
||||
res = super(LinkTrackerClick, self).add_click(code, ip, country_code, stat_id=stat_id)
|
||||
if stat_id:
|
||||
stat_sudo = self.env['mail.mail.statistics'].sudo().browse(stat_id)
|
||||
stat_sudo.set_opened()
|
||||
stat_sudo.set_clicked()
|
||||
return res
|
||||
|
||||
def _get_click_values_from_route(self, route_values):
|
||||
click_values = super(LinkTrackerClick, self)._get_click_values_from_route(route_values)
|
||||
if route_values['stat_id']:
|
||||
mail_stat = self.env['mail.mail.statistics'].browse(route_values['stat_id'])
|
||||
click_values['mail_stat_id'] = mail_stat.id
|
||||
if mail_stat.mass_mailing_campaign_id:
|
||||
click_values['mass_mailing_campaign_id'] = mail_stat.mass_mailing_campaign_id.id
|
||||
if mail_stat.mass_mailing_id:
|
||||
click_values['mass_mailing_id'] = mail_stat.mass_mailing_id.id
|
||||
return click_values
|
||||
|
||||
@@ -37,6 +37,7 @@ class MailThread(models.AbstractModel):
|
||||
matching message_id in mail.mail.statistics. """
|
||||
if message.get('References'):
|
||||
message_ids = [x.strip() for x in decode_smtp_header(message['References']).split()]
|
||||
self.env['mail.mail.statistics'].set_opened(mail_message_ids=message_ids)
|
||||
self.env['mail.mail.statistics'].set_replied(mail_message_ids=message_ids)
|
||||
return super(MailThread, self).message_route_process(message, message_dict, routes)
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import hmac
|
||||
from datetime import datetime
|
||||
import logging
|
||||
import random
|
||||
import threading
|
||||
|
||||
from odoo import api, fields, models, tools, _
|
||||
from odoo.exceptions import UserError
|
||||
@@ -290,22 +291,6 @@ class MassMailing(models.Model):
|
||||
res['reply_to_mode'] = 'thread'
|
||||
return res
|
||||
|
||||
def _get_mailing_model(self):
|
||||
res = []
|
||||
for model_name in self.env:
|
||||
model = self.env[model_name]
|
||||
if hasattr(model, '_mail_mass_mailing') and getattr(model, '_mail_mass_mailing'):
|
||||
if getattr(model, 'message_mass_mailing_enabled'):
|
||||
res.append((model._name, model.message_mass_mailing_enabled()))
|
||||
else:
|
||||
res.append((model._name, model._mail_mass_mailing))
|
||||
res.append(('mail.mass_mailing.contact', _('Mail Contacts')))
|
||||
res.append(('mail.mass_mailing.list', _('Mailing List')))
|
||||
return res
|
||||
|
||||
# indirections for inheritance
|
||||
_mailing_model = lambda self: self._get_mailing_model()
|
||||
|
||||
active = fields.Boolean(default=True)
|
||||
email_from = fields.Char(string='From', required=True,
|
||||
default=lambda self: self.env['mail.message']._get_default_from())
|
||||
@@ -335,7 +320,9 @@ class MassMailing(models.Model):
|
||||
default=lambda self: self.env['mail.message']._get_default_from())
|
||||
# recipients
|
||||
mailing_model_real = fields.Char(compute='_compute_model', string='Recipients Real Model', default='mail.mass_mailing.contact', required=True)
|
||||
mailing_model = fields.Selection(selection=_mailing_model, string='Recipients Model', default='mail.mass_mailing.list')
|
||||
mailing_model_id = fields.Many2one('ir.model', string='Recipients Model', domain="[('is_mail_thread', '=', True)]",
|
||||
default=lambda self: self.env.ref('mass_mailing.model_mail_mass_mailing_list').id)
|
||||
mailing_model_name = fields.Char(related='mailing_model_id.model', string='Recipients Model Name')
|
||||
mailing_domain = fields.Char(string='Domain', oldname='domain', default=[])
|
||||
contact_list_ids = fields.Many2many('mail.mass_mailing.list', 'mail_mass_mailing_list_rel',
|
||||
string='Mailing Lists')
|
||||
@@ -376,10 +363,10 @@ class MassMailing(models.Model):
|
||||
for mass_mailing in self:
|
||||
mass_mailing.clicks_ratio = mapped_data.get(mass_mailing.id, 0)
|
||||
|
||||
@api.depends('mailing_model')
|
||||
@api.depends('mailing_model_id')
|
||||
def _compute_model(self):
|
||||
for record in self:
|
||||
record.mailing_model_real = (record.mailing_model != 'mail.mass_mailing.list') and record.mailing_model or 'mail.mass_mailing.contact'
|
||||
record.mailing_model_real = (record.mailing_model_name != 'mail.mass_mailing.list') and record.mailing_model_name or 'mail.mass_mailing.contact'
|
||||
|
||||
def _compute_statistics(self):
|
||||
""" Compute statistics of the mass mailing """
|
||||
@@ -451,14 +438,14 @@ class MassMailing(models.Model):
|
||||
'medium_id': self.mass_mailing_campaign_id.medium_id}
|
||||
self.update(dic)
|
||||
|
||||
@api.onchange('mailing_model', 'contact_list_ids')
|
||||
@api.onchange('mailing_model_id', 'contact_list_ids')
|
||||
def _onchange_model_and_list(self):
|
||||
if self.mailing_model == 'mail.mass_mailing.list':
|
||||
if self.mailing_model_name == 'mail.mass_mailing.list':
|
||||
if self.contact_list_ids:
|
||||
self.mailing_domain = "[('list_ids', 'in', [%s]), ('opt_out', '=', False)]" % (','.join(str(id) for id in self.contact_list_ids.ids),)
|
||||
else:
|
||||
self.mailing_domain = "[(0, '=', 1)]"
|
||||
elif 'opt_out' in self.env[self.mailing_model]._fields and not self.mailing_domain:
|
||||
elif 'opt_out' in self.env[self.mailing_model_name]._fields and not self.mailing_domain:
|
||||
self.mailing_domain = "[('opt_out', '=', False)]"
|
||||
self.body_html = "on_change_model_and_list"
|
||||
|
||||
@@ -659,11 +646,12 @@ class MassMailing(models.Model):
|
||||
already_mailed_res_ids = [record['res_id'] for record in already_mailed]
|
||||
return list(set(res_ids) - set(already_mailed_res_ids))
|
||||
|
||||
def send_mail(self):
|
||||
def send_mail(self, res_ids=None):
|
||||
author_id = self.env.user.partner_id.id
|
||||
|
||||
for mailing in self:
|
||||
# instantiate an email composer + send emails
|
||||
res_ids = mailing.get_remaining_recipients()
|
||||
if not res_ids:
|
||||
res_ids = mailing.get_remaining_recipients()
|
||||
if not res_ids:
|
||||
raise UserError(_('Please select recipients.'))
|
||||
|
||||
@@ -689,7 +677,9 @@ class MassMailing(models.Model):
|
||||
composer = self.env['mail.compose.message'].with_context(active_ids=res_ids).create(composer_values)
|
||||
extra_context = self._get_mass_mailing_context()
|
||||
composer = composer.with_context(active_ids=res_ids, **extra_context)
|
||||
composer.send_mail(auto_commit=True)
|
||||
# auto-commit except in testing mode
|
||||
auto_commit = not getattr(threading.currentThread(), 'testing', False)
|
||||
composer.send_mail(auto_commit=auto_commit)
|
||||
mailing.state = 'done'
|
||||
return True
|
||||
|
||||
|
||||
@@ -38,7 +38,10 @@ class MailMailStats(models.Model):
|
||||
opened = fields.Datetime(help='Date when the email has been opened the first time')
|
||||
replied = fields.Datetime(help='Date when this email has been replied for the first time.')
|
||||
bounced = fields.Datetime(help='Date when this email has bounced.')
|
||||
# Link tracking
|
||||
links_click_ids = fields.One2many('link.tracker.click', 'mail_stat_id', string='Links click')
|
||||
clicked = fields.Datetime(help='Date when customer clicked on at least one tracked link')
|
||||
# Status
|
||||
state = fields.Selection(compute="_compute_state",
|
||||
selection=[('outgoing', 'Outgoing'),
|
||||
('exception', 'Exception'),
|
||||
@@ -51,7 +54,7 @@ class MailMailStats(models.Model):
|
||||
store=True)
|
||||
recipient = fields.Char(compute="_compute_recipient")
|
||||
|
||||
@api.depends('sent', 'opened', 'replied', 'bounced', 'exception')
|
||||
@api.depends('sent', 'opened', 'clicked', 'replied', 'bounced', 'exception')
|
||||
def _compute_state(self):
|
||||
self.update({'state_update': fields.Datetime.now()})
|
||||
for stat in self:
|
||||
@@ -59,7 +62,7 @@ class MailMailStats(models.Model):
|
||||
stat.state = 'exception'
|
||||
elif stat.sent:
|
||||
stat.state = 'sent'
|
||||
elif stat.opened:
|
||||
elif stat.opened or stat.clicked:
|
||||
stat.state = 'opened'
|
||||
elif stat.replied:
|
||||
stat.state = 'replied'
|
||||
@@ -105,6 +108,11 @@ class MailMailStats(models.Model):
|
||||
statistics.write({'opened': fields.Datetime.now()})
|
||||
return statistics
|
||||
|
||||
def set_clicked(self, mail_mail_ids=None, mail_message_ids=None):
|
||||
statistics = self._get_records(mail_mail_ids, mail_message_ids, [('clicked', '=', False)])
|
||||
statistics.write({'clicked': fields.Datetime.now()})
|
||||
return statistics
|
||||
|
||||
def set_replied(self, mail_mail_ids=None, mail_message_ids=None):
|
||||
statistics = self._get_records(mail_mail_ids, mail_message_ids, [('replied', '=', False)])
|
||||
statistics.write({'replied': fields.Datetime.now()})
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<field name="mass_mailing_id"/>
|
||||
<filter string="Received" name="filter_received" domain="[('sent', '!=', False), ('bounced', '=', False)]"/>
|
||||
<filter string="Opened" name="filter_opened" domain="[('opened', '!=', False)]"/>
|
||||
<filter string="Clicked" name="filter_clicked" domain="[('clicked', '!=', False)]"/>
|
||||
<filter string="Replied" name="filter_replied" domain="[('replied', '!=', False)]"/>
|
||||
<filter string="Bounced" name="filter_bounced" domain="[('bounced', '!=', False)]"/>
|
||||
<group expand="0" string="Group By">
|
||||
@@ -34,6 +35,7 @@
|
||||
<field name="sent"/>
|
||||
<field name="exception"/>
|
||||
<field name="opened"/>
|
||||
<field name="clicked"/>
|
||||
<field name="replied"/>
|
||||
<field name="bounced"/>
|
||||
</tree>
|
||||
@@ -54,6 +56,7 @@
|
||||
<field name="exception"/>
|
||||
<field name="sent"/>
|
||||
<field name="opened"/>
|
||||
<field name="clicked"/>
|
||||
<field name="replied"/>
|
||||
<field name="bounced"/>
|
||||
</group>
|
||||
|
||||
@@ -413,15 +413,16 @@
|
||||
<div>
|
||||
<field name="name" nolabel="1"/>
|
||||
</div>
|
||||
<label for="mailing_model" string="Recipients"/>
|
||||
<label for="mailing_model_id" string="Recipients"/>
|
||||
<div>
|
||||
<field name="mailing_model" widget="radio" options="{'horizontal': true}"/>
|
||||
<field name="mailing_model_id"/>
|
||||
<field name="mailing_model_name" invisible="1"/>
|
||||
<field name="mailing_model_real" invisible="1"/>
|
||||
<field name="mailing_domain" widget="domain"
|
||||
attrs="{'invisible': [('mailing_model', '=', 'mail.mass_mailing.list')]}"
|
||||
attrs="{'invisible': [('mailing_model_name', '=', 'mail.mass_mailing.list')]}"
|
||||
options="{'model': 'mailing_model_real'}"
|
||||
context="{'search_default_not_opt_out':1}"/>
|
||||
<div attrs="{'invisible': [('mailing_model', '!=', 'mail.mass_mailing.list')]}">
|
||||
<div attrs="{'invisible': [('mailing_model_name', '!=', 'mail.mass_mailing.list')]}">
|
||||
<label for="contact_list_ids" string="Select mailing lists:" class="oe_edit_only"/>
|
||||
<field name="contact_list_ids" widget="many2many_tags"
|
||||
placeholder="Select mailing lists..." class="oe_inline"/>
|
||||
@@ -443,7 +444,7 @@
|
||||
<label for="reply_to"/>
|
||||
<div>
|
||||
<field name="reply_to_mode" widget="radio"
|
||||
attrs="{'invisible': [('mailing_model', 'in', ['mail.mass_mailing.contact', 'res.partner'])]}"/>
|
||||
attrs="{'invisible': [('mailing_model_name', 'in', ['mail.mass_mailing.contact', 'res.partner'])]}"/>
|
||||
<field name="reply_to"
|
||||
attrs="{'required': [('reply_to_mode', '=', 'email')]}"/>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,7 @@ class MailComposeMessage(models.TransientModel):
|
||||
# use only for allowed models in mass mailing
|
||||
if self.composition_mode == 'mass_mail' and \
|
||||
(self.mass_mailing_name or self.mass_mailing_id) and \
|
||||
self.model in [item[0] for item in self.env['mail.mass_mailing']._get_mailing_model()]:
|
||||
self.env['ir.model'].sudo().search([('model', '=', self.model), ('is_mail_thread', '=', True)], limit=1):
|
||||
mass_mailing = self.mass_mailing_id
|
||||
if not mass_mailing:
|
||||
reply_to_mode = 'email' if self.no_auto_thread else 'thread'
|
||||
@@ -37,7 +37,7 @@ class MailComposeMessage(models.TransientModel):
|
||||
'reply_to': reply_to,
|
||||
'sent_date': fields.Datetime.now(),
|
||||
'body_html': self.body,
|
||||
'mailing_model': self.model,
|
||||
'mailing_model_id': self.env['ir.model'].search([('model', '=', self.model)], limit=1).id,
|
||||
'mailing_domain': self.active_domain,
|
||||
})
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class Event(models.Model):
|
||||
view_mode='form',
|
||||
target='current',
|
||||
context=dict(
|
||||
default_mailing_model='event.registration',
|
||||
default_mailing_model_id=self.env.ref('event.model_event_registration').id,
|
||||
default_mailing_domain="[('event_id', 'in', %s)]" % self.ids, # , ('state', 'in', ['draft', 'open', 'done'])
|
||||
),
|
||||
)
|
||||
|
||||
@@ -16,7 +16,7 @@ class Event(models.Model):
|
||||
view_mode='form',
|
||||
target='current',
|
||||
context=dict(
|
||||
default_mailing_model='event.track',
|
||||
default_mailing_model=self.env.ref('website_event_track.model_event_track').id,
|
||||
default_mailing_domain="[('event_id', 'in', %s), ('stage_id.is_cancel', '!=', True)]" % self.ids,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -813,7 +813,7 @@
|
||||
</t>
|
||||
<t t-name="FieldReference" t-extend="FieldMany2One">
|
||||
<t t-jquery=".o_input_dropdown" t-operation="before">
|
||||
<select class="o_input o_field_widget">
|
||||
<select t-att-class="'o_input o_field_widget' + (widget.nodeOptions.hide_model and ' hidden' or '')">
|
||||
<option/>
|
||||
<option t-foreach="widget.field.selection" t-as="model" t-att-value="model[0]"><t t-esc="model[1]"/></option>
|
||||
</select>
|
||||
|
||||
@@ -50,7 +50,6 @@ class Track(models.Model):
|
||||
_description = 'Event Track'
|
||||
_order = 'priority, date'
|
||||
_inherit = ['mail.thread', 'mail.activity.mixin', 'website.seo.metadata', 'website.published.mixin']
|
||||
_mail_mass_mailing = _('Track Speakers')
|
||||
|
||||
@api.model
|
||||
def _get_default_stage_id(self):
|
||||
|
||||
@@ -11,7 +11,7 @@ class MassMailController(MassMailController):
|
||||
def mailing(self, mailing_id, email=None, res_id=None, **post):
|
||||
mailing = request.env['mail.mass_mailing'].sudo().browse(mailing_id)
|
||||
if mailing.exists():
|
||||
if mailing.mailing_model == 'mail.mass_mailing.contact':
|
||||
if mailing.mailing_model_name == 'mail.mass_mailing.contact':
|
||||
contacts = request.env['mail.mass_mailing.contact'].sudo().search([('email', '=', email)])
|
||||
return request.render('website_mass_mailing.page_unsubscribe', {
|
||||
'contacts': contacts,
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
|
||||
<record model="ir.rule" id="res_partner_rule">
|
||||
<field name="name">res.partner company</field>
|
||||
<field name="model_id" ref="model_res_partner"/>
|
||||
<field name="model_id" ref="base.model_res_partner"/>
|
||||
<!--
|
||||
Show partners from ancestors and descendants companies
|
||||
(or company-less), this is usually a better default for
|
||||
|
||||
Reference in New Issue
Block a user