diff options
| author | Nicolas Lempereur <nle@odoo.com> | 2015-07-22 16:03:19 +0200 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2015-07-23 15:48:53 +0200 |
| commit | 0e151f7f32d8965bcaadc661b7e091490762b903 (patch) | |
| tree | 96644c6b06a2474e2a0c923529b6adf923b1d568 /addons/web_view_editor/static/src | |
| parent | c0bf28534ed688fd6173a9dcfe29d7be930bb092 (diff) | |
[FIX] web_view_editor: javascript errors
A jquery selector $('td[id^=]') may have been valid once uppon a time,
but it cause error on current jquery versions.
Also in some case when we want to add a field on a view, there may be
a mess to detect the parent.
opw-645557
Diffstat (limited to 'addons/web_view_editor/static/src')
| -rw-r--r-- | addons/web_view_editor/static/src/js/view_editor.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/web_view_editor/static/src/js/view_editor.js b/addons/web_view_editor/static/src/js/view_editor.js index 524c415d34a..de17c29799f 100644 --- a/addons/web_view_editor/static/src/js/view_editor.js +++ b/addons/web_view_editor/static/src/js/view_editor.js @@ -534,6 +534,8 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({ var tr = self.get_object_by_id(this.one_object.clicked_tr_id, this.one_object['main_object'], [])[0].att_list[0]; var parent_tr = ($(side).prevAll("tr[level=" + String(this.one_object.clicked_tr_level - 1) + "]"))[0]; var field_dataset = new instance.web.DataSetSearch(this, this.model, null, null); + if(_.isUndefined(parent_tr)) + return; parent_tr = self.get_object_by_id(parseInt($(parent_tr).attr('id').replace(/[^0-9]+/g, '')), this.one_object['main_object'], [])[0].att_list[0]; _.each([tr, parent_tr],function(element) { var value = _.has(_CHILDREN, element) ? element : _.str.include(html_tag, element)?"html_tag":false; @@ -998,7 +1000,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({ type_widget.set_value(node.value); self.add_widget.push(type_widget); }); - table_selector.find("td[id^=]").attr("width","100px"); + table_selector.find("td[id^='']").attr("width","100px"); self.add_node_dialog.$el.find('#new_field').click(function() { model_data = new instance.web.DataSetSearch(self,'ir.model', null, null); model_data.read_slice([], {domain: [['model','=', self.model]]}).done(function(result) { |
