diff --git a/addons/web/i18n/web.pot b/addons/web/i18n/web.pot index 6522ed569ce..3217d20f3fe 100644 --- a/addons/web/i18n/web.pot +++ b/addons/web/i18n/web.pot @@ -1073,6 +1073,13 @@ msgstr "" msgid "Error" msgstr "" +#. module: web +#. openerp-web +#: code:addons/web/static/src/js/views/form_widgets.js:2600 +#, python-format +msgid "Error: Bad domain" +msgstr "" + #. module: web #: code:addons/web/controllers/main.py:764 #: code:addons/web/controllers/main.py:805 @@ -2318,6 +2325,13 @@ msgstr "" msgid "The database has been duplicated." msgstr "" +#. module: web +#. openerp-web +#: code:addons/web/static/src/js/views/form_widgets.js:2600 +#, python-format +msgid "The domain is wrong." +msgstr "" + #. module: web #. openerp-web #: code:addons/web/static/src/js/view_form.js:5637 diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index cdf73ee06ae..6588340e4d7 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2593,7 +2593,13 @@ instance.web.form.FieldCharDomain = instance.web.form.AbstractField.extend(insta this.$el.html(instance.web.qweb.render("FieldCharDomain", {widget: this})); if (this.get('value')) { var model = this.options.model || this.field_manager.get_field_value(this.options.model_field); - var domain = instance.web.pyeval.eval('domain', this.get('value')); + try{ + var domain = pyeval.eval('domain', this.get('value')); + } + catch(e){ + this.do_warn(_t('Error: Bad domain'), _t('The domain is wrong.')); + return; + } var ds = new instance.web.DataSetStatic(self, model, self.build_context()); ds.call('search_count', [domain, self.build_context()]).then(function (results) { $('.oe_domain_count', self.$el).text(results + _t(' records selected'));