[FIX] web: raise a warning for bad domain

When a user wrote a wrong value in char_domain field it should raise a warning
message instead of a traceback.

opw:676783
This commit is contained in:
Goffin Simon
2016-05-09 09:35:13 +02:00
parent 9cdc40e3ed
commit b3a88b6ed8
2 changed files with 21 additions and 1 deletions
+14
View File
@@ -871,6 +871,13 @@ msgstr ""
msgid "Error"
msgstr ""
#. module: web
#. openerp-web
#: code:addons/web/static/src/js/views/form_widgets.js:458
#, python-format
msgid "Error: Bad domain"
msgstr ""
#. module: web
#: code:addons/web/controllers/main.py:838
#, python-format
@@ -2072,6 +2079,13 @@ msgstr ""
msgid "Technical Translation"
msgstr ""
#. module: web
#. openerp-web
#: code:addons/web/static/src/js/views/form_widgets.js:458
#, python-format
msgid "The domain is wrong."
msgstr ""
#. module: web
#. openerp-web
#: code:addons/web/static/src/js/views/form_widgets.js:1208
@@ -455,7 +455,13 @@ var FieldCharDomain = common.AbstractField.extend(common.ReinitializeFieldMixin,
if (this.get('value')) {
var model = this.options.model || this.field_manager.get_field_value(this.options.model_field);
var domain = 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 data.DataSetStatic(self, model, self.build_context());
ds.call('search_count', [domain]).then(function (results) {
self.$('.o_count').text(results + _t(' selected records'));