From 42cdf0071e7471a682b6af5de530eb9b1f8e5dff Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 4 Nov 2014 17:17:45 +0100 Subject: [PATCH 1/3] [FIX] web: keep pager in popup list view When an action opens records in list (or other) mode in a popup (target:new), the pager should be kept. It can be removed in form view. Fixes #742 --- addons/web/static/src/js/views.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 1fac5794679..5fa3c8fb290 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -333,12 +333,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 }); From 2fb2d9f956b5ddd37da3cc3fdb9f55ea1f0e1878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=A1zquez=20Acosta?= Date: Fri, 3 Oct 2014 09:19:30 -0400 Subject: [PATCH 2/3] [FIX] mail: partners with missing/invalid emails must not halt notifications to others --- addons/mail/mail_mail.py | 19 +++++++++++++++++-- openerp/addons/base/ir/ir_mail_server.py | 8 ++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/addons/mail/mail_mail.py b/addons/mail/mail_mail.py index 1c53d0477a7..b71176bcd08 100644 --- a/addons/mail/mail_mail.py +++ b/addons/mail/mail_mail.py @@ -305,8 +305,23 @@ class mail_mail(osv.Model): object_id = mail.res_id and ('%s-%s' % (mail.res_id, mail.model)), subtype = 'html', subtype_alternative = 'plain') - res = ir_mail_server.send_email(cr, uid, msg, - mail_server_id=mail.mail_server_id.id, context=context) + 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 diff --git a/openerp/addons/base/ir/ir_mail_server.py b/openerp/addons/base/ir/ir_mail_server.py index 2624abb8c5f..881eafb8549 100644 --- a/openerp/addons/base/ir/ir_mail_server.py +++ b/openerp/addons/base/ir/ir_mail_server.py @@ -146,11 +146,15 @@ 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', size=64, required=True, select=True), 'smtp_host': fields.char('SMTP Server', size=128, required=True, help="Hostname or IP of SMTP server"), @@ -397,7 +401,7 @@ class ir_mail_server(osv.osv): email_cc = message['Cc'] 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 # Do not actually send emails in testing mode! if getattr(threading.currentThread(), 'testing', False): From be7c894cfd4940004f694ed66beefd45f8e98c0f Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 4 Nov 2014 17:45:53 +0100 Subject: [PATCH 3/3] [FIX] web_kanban: wrong condition to reset the dataset index This is related to rev. a218a9ed3f6c965820f2ebdf76ee0e6c89c59a0c The condition is good, but not in the right place: It should be done once all read_slice (all columns records) are fetched, not at each read_slice end --- addons/web_kanban/static/src/js/kanban.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index a0d16356517..23fa4923277 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -260,8 +260,8 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ self.no_result(); return false; } - var remaining = groups.length - 1, - groups_array = []; + self.nb_records = 0; + 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, @@ -270,16 +270,16 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ def = dataset.read_slice(self.fields_keys.concat(['__last_update']), { 'limit': self.limit }); } return def.then(function(records) { + 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.dataset.index >= self.nb_records){ + self.dataset.index = self.dataset.size() ? 0 : null; + } + return self.do_add_groups(groups_array); + }); }); }, do_process_dataset: function() {