[MERGE] forward port of branch saas-3 up to f7a76cb

This commit is contained in:
Denis Ledoux 2014-11-04 18:05:58 +01:00
commit fab2e29d50
4 changed files with 24 additions and 12 deletions

View File

@ -298,10 +298,20 @@ class mail_mail(osv.Model):
subtype='html',
subtype_alternative='plain',
headers=headers)
res = ir_mail_server.send_email(cr, uid, msg,
try:
res = ir_mail_server.send_email(cr, uid, msg,
mail_server_id=mail.mail_server_id.id,
context=context)
except AssertionError as error:
if error.message == ir_mail_server.NO_VALID_RECIPIENT:
# No valid recipient found for this particular
# mail item -> ignore error to avoid blocking
# delivery to next recipients, if any. If this is
# the only recipient, the mail will show as failed.
_logger.warning("Ignoring invalid recipients for mail.mail %s: %s",
mail.message_id, email.get('email_to'))
else:
raise
if res:
mail.write({'state': 'sent', 'message_id': res})
mail_sent = True

View File

@ -370,12 +370,13 @@ instance.web.ActionManager = instance.web.Widget.extend({
var type = action.type.replace(/\./g,'_');
var popup = action.target === 'new';
var inline = action.target === 'inline' || action.target === 'inlineview';
var form = _.str.startsWith(action.view_mode, 'form');
action.flags = _.defaults(action.flags || {}, {
views_switcher : !popup && !inline,
search_view : !popup && !inline,
action_buttons : !popup && !inline,
sidebar : !popup && !inline,
pager : !popup && !inline,
pager : (!popup || !form) && !inline,
display_title : !popup,
search_disable_custom_filters: action.context && action.context.search_disable_custom_filters
});

View File

@ -274,8 +274,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
return false;
}
self.nb_records = 0;
var remaining = groups.length - 1,
groups_array = [];
var groups_array = [];
return $.when.apply(null, _.map(groups, function (group, index) {
var def = $.when([]);
var dataset = new instance.web.DataSetSearch(self, self.dataset.model,
@ -287,17 +286,15 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
self.nb_records += records.length;
self.dataset.ids.push.apply(self.dataset.ids, dataset.ids);
groups_array[index] = new instance.web_kanban.KanbanGroup(self, records, group, dataset);
if (self.dataset.index >= records.length){
self.dataset.index = self.dataset.size() ? 0 : null;
}
if (!remaining--) {
return self.do_add_groups(groups_array);
}
});
})).then(function () {
if(!self.nb_records) {
self.no_result();
}
if (self.dataset.index >= self.nb_records){
self.dataset.index = self.dataset.size() ? 0 : null;
}
return self.do_add_groups(groups_array);
});
});
},

View File

@ -149,10 +149,14 @@ def encode_rfc2822_address_header(header_text):
addresses = getaddresses([tools.ustr(header_text).encode('utf-8')])
return COMMASPACE.join(map(encode_addr, addresses))
class ir_mail_server(osv.osv):
"""Represents an SMTP server, able to send outgoing emails, with SSL and TLS capabilities."""
_name = "ir.mail_server"
NO_VALID_RECIPIENT = ("At least one valid recipient address should be "
"specified for outgoing emails (To/Cc/Bcc)")
_columns = {
'name': fields.char('Description', required=True, select=True),
'smtp_host': fields.char('SMTP Server', required=True, help="Hostname or IP of SMTP server"),
@ -400,7 +404,7 @@ class ir_mail_server(osv.osv):
email_bcc = message['Bcc']
smtp_to_list = filter(None, tools.flatten(map(extract_rfc2822_addresses,[email_to, email_cc, email_bcc])))
assert smtp_to_list, "At least one valid recipient address should be specified for outgoing emails (To/Cc/Bcc)"
assert smtp_to_list, self.NO_VALID_RECIPIENT
x_forge_to = message['X-Forge-To']
if x_forge_to: