[MERGE] forward port of branch saas-3 up to f7a76cb
This commit is contained in:
commit
fab2e29d50
|
@ -298,10 +298,20 @@ class mail_mail(osv.Model):
|
||||||
subtype='html',
|
subtype='html',
|
||||||
subtype_alternative='plain',
|
subtype_alternative='plain',
|
||||||
headers=headers)
|
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,
|
mail_server_id=mail.mail_server_id.id,
|
||||||
context=context)
|
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:
|
if res:
|
||||||
mail.write({'state': 'sent', 'message_id': res})
|
mail.write({'state': 'sent', 'message_id': res})
|
||||||
mail_sent = True
|
mail_sent = True
|
||||||
|
|
|
@ -370,12 +370,13 @@ instance.web.ActionManager = instance.web.Widget.extend({
|
||||||
var type = action.type.replace(/\./g,'_');
|
var type = action.type.replace(/\./g,'_');
|
||||||
var popup = action.target === 'new';
|
var popup = action.target === 'new';
|
||||||
var inline = action.target === 'inline' || action.target === 'inlineview';
|
var inline = action.target === 'inline' || action.target === 'inlineview';
|
||||||
|
var form = _.str.startsWith(action.view_mode, 'form');
|
||||||
action.flags = _.defaults(action.flags || {}, {
|
action.flags = _.defaults(action.flags || {}, {
|
||||||
views_switcher : !popup && !inline,
|
views_switcher : !popup && !inline,
|
||||||
search_view : !popup && !inline,
|
search_view : !popup && !inline,
|
||||||
action_buttons : !popup && !inline,
|
action_buttons : !popup && !inline,
|
||||||
sidebar : !popup && !inline,
|
sidebar : !popup && !inline,
|
||||||
pager : !popup && !inline,
|
pager : (!popup || !form) && !inline,
|
||||||
display_title : !popup,
|
display_title : !popup,
|
||||||
search_disable_custom_filters: action.context && action.context.search_disable_custom_filters
|
search_disable_custom_filters: action.context && action.context.search_disable_custom_filters
|
||||||
});
|
});
|
||||||
|
|
|
@ -274,8 +274,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
self.nb_records = 0;
|
self.nb_records = 0;
|
||||||
var remaining = groups.length - 1,
|
var groups_array = [];
|
||||||
groups_array = [];
|
|
||||||
return $.when.apply(null, _.map(groups, function (group, index) {
|
return $.when.apply(null, _.map(groups, function (group, index) {
|
||||||
var def = $.when([]);
|
var def = $.when([]);
|
||||||
var dataset = new instance.web.DataSetSearch(self, self.dataset.model,
|
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.nb_records += records.length;
|
||||||
self.dataset.ids.push.apply(self.dataset.ids, dataset.ids);
|
self.dataset.ids.push.apply(self.dataset.ids, dataset.ids);
|
||||||
groups_array[index] = new instance.web_kanban.KanbanGroup(self, records, group, dataset);
|
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 () {
|
})).then(function () {
|
||||||
if(!self.nb_records) {
|
if(!self.nb_records) {
|
||||||
self.no_result();
|
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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -149,10 +149,14 @@ def encode_rfc2822_address_header(header_text):
|
||||||
addresses = getaddresses([tools.ustr(header_text).encode('utf-8')])
|
addresses = getaddresses([tools.ustr(header_text).encode('utf-8')])
|
||||||
return COMMASPACE.join(map(encode_addr, addresses))
|
return COMMASPACE.join(map(encode_addr, addresses))
|
||||||
|
|
||||||
|
|
||||||
class ir_mail_server(osv.osv):
|
class ir_mail_server(osv.osv):
|
||||||
"""Represents an SMTP server, able to send outgoing emails, with SSL and TLS capabilities."""
|
"""Represents an SMTP server, able to send outgoing emails, with SSL and TLS capabilities."""
|
||||||
_name = "ir.mail_server"
|
_name = "ir.mail_server"
|
||||||
|
|
||||||
|
NO_VALID_RECIPIENT = ("At least one valid recipient address should be "
|
||||||
|
"specified for outgoing emails (To/Cc/Bcc)")
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Description', required=True, select=True),
|
'name': fields.char('Description', required=True, select=True),
|
||||||
'smtp_host': fields.char('SMTP Server', required=True, help="Hostname or IP of SMTP server"),
|
'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']
|
email_bcc = message['Bcc']
|
||||||
|
|
||||||
smtp_to_list = filter(None, tools.flatten(map(extract_rfc2822_addresses,[email_to, email_cc, email_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']
|
x_forge_to = message['X-Forge-To']
|
||||||
if x_forge_to:
|
if x_forge_to:
|
||||||
|
|
Loading…
Reference in New Issue