[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:
@@ -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'));
|
||||
|
||||
Reference in New Issue
Block a user