From c96eb7e1d8ba3c99e4516bfabe1af010ab73167c Mon Sep 17 00:00:00 2001 From: Peter Hahn Date: Thu, 28 Jan 2016 11:11:40 +0100 Subject: [PATCH] More robust email checkking --- .../static/src/js/web_widget_mail_send_odoo.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/web_widget_mail_send_odoo/static/src/js/web_widget_mail_send_odoo.js b/web_widget_mail_send_odoo/static/src/js/web_widget_mail_send_odoo.js index da0c9279..51b6f2b0 100644 --- a/web_widget_mail_send_odoo/static/src/js/web_widget_mail_send_odoo.js +++ b/web_widget_mail_send_odoo/static/src/js/web_widget_mail_send_odoo.js @@ -27,6 +27,23 @@ openerp.web_widget_mail_send_odoo = function(instance) { .text(self.get('value') || ''); } }, + is_syntax_valid: function(){ + var self = this; + if(!self._super()) + return false; + if (!self.get("effective_readonly") && 0 < self.$("input").size() && self.$("input").val()) { + try { + var parsed_email = instance.mail.ChatterUtils.parse_email(self.$("input").val()); + console.log(parsed_email) + if(!parsed_email[1]) + return false; + return true; + } catch(e) { + return false; + } + } + return true; + }, on_clicked: function() { var self = this; if (!self.get('value') || !self.is_syntax_valid()) {