Merge pull request #232 from odoo-dev/saas-4-mass_mailing-fixes-tde
[FIX] mass_mailing: fixes in mail (default recipients), mass_mailing (recipients computation), web (chardomain widget)
This commit is contained in:
@@ -662,9 +662,10 @@ class mail_thread(osv.AbstractModel):
|
||||
|
||||
def message_get_default_recipients(self, cr, uid, ids, context=None):
|
||||
if context and context.get('thread_model') and context['thread_model'] in self.pool and context['thread_model'] != self._name:
|
||||
sub_ctx = dict(context)
|
||||
sub_ctx.pop('thread_model')
|
||||
return self.pool[context['thread_model']].message_get_default_recipients(cr, uid, ids, context=sub_ctx)
|
||||
if hasattr(self.pool[context['thread_model']], 'message_get_default_recipients'):
|
||||
sub_ctx = dict(context)
|
||||
sub_ctx.pop('thread_model')
|
||||
return self.pool[context['thread_model']].message_get_default_recipients(cr, uid, ids, context=sub_ctx)
|
||||
res = {}
|
||||
for record in self.browse(cr, SUPERUSER_ID, ids, context=context):
|
||||
recipient_ids, email_to, email_cc = set(), False, False
|
||||
|
||||
@@ -4,10 +4,9 @@ from datetime import datetime
|
||||
from dateutil import relativedelta
|
||||
import json
|
||||
import random
|
||||
import urllib
|
||||
import urlparse
|
||||
|
||||
from openerp import tools
|
||||
from openerp.exceptions import Warning
|
||||
from openerp.tools.safe_eval import safe_eval as eval
|
||||
from openerp.tools.translate import _
|
||||
from openerp.osv import osv, fields
|
||||
@@ -62,6 +61,12 @@ class MassMailingContact(osv.Model):
|
||||
rec_id = self.create(cr, uid, {'name': name, 'email': email}, context=context)
|
||||
return self.name_get(cr, uid, [rec_id], context)[0]
|
||||
|
||||
def message_get_default_recipients(self, cr, uid, ids, context=None):
|
||||
res = {}
|
||||
for record in self.browse(cr, uid, ids, context=context):
|
||||
res[record.id] = {'partner_ids': [], 'email_to': record.email, 'email_cc': False}
|
||||
return res
|
||||
|
||||
|
||||
class MassMailingList(osv.Model):
|
||||
"""Model of a contact list. """
|
||||
@@ -549,6 +554,8 @@ class MassMailing(osv.Model):
|
||||
for mailing in self.browse(cr, uid, ids, context=context):
|
||||
# instantiate an email composer + send emails
|
||||
res_ids = self.get_recipients(cr, uid, mailing, context=context)
|
||||
if not res_ids:
|
||||
raise Warning('Please select recipients.')
|
||||
comp_ctx = dict(context, active_ids=res_ids)
|
||||
composer_values = {
|
||||
'author_id': author_id,
|
||||
|
||||
@@ -2481,6 +2481,7 @@ instance.web.form.FieldCharDomain = instance.web.form.AbstractField.extend(insta
|
||||
this.$('.select_records').on('click', self.on_click);
|
||||
},
|
||||
on_click: function(ev) {
|
||||
event.preventDefault();
|
||||
var self = this;
|
||||
var model = this.options.model || this.field_manager.get_field_value(this.options.model_field);
|
||||
this.pop = new instance.web.form.SelectCreatePopup(this);
|
||||
@@ -2499,15 +2500,14 @@ instance.web.form.FieldCharDomain = instance.web.form.AbstractField.extend(insta
|
||||
});
|
||||
}
|
||||
else {
|
||||
var domain = ["id", "in", element_ids];
|
||||
var domain = [["id", "in", element_ids]];
|
||||
var domain_done = $.Deferred().resolve(domain);
|
||||
}
|
||||
$.when(domain_done).then(function (domain) {
|
||||
var domain = self.pop.dataset.domain.concat(domain || []);
|
||||
self.set_value(JSON.stringify(domain))
|
||||
self.set_value(domain);
|
||||
});
|
||||
});
|
||||
event.preventDefault();
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user