Merge lp:~alexaubin/unifield-web/US-2937 into lp:unifield-web

Proposed by jftempo
Status: Merged
Merged at revision: 4872
Proposed branch: lp:~alexaubin/unifield-web/US-2937
Merge into: lp:unifield-web
Diff against target: 56 lines (+14/-7)
1 file modified
addons/openerp/static/javascript/form_state.js (+14/-7)
To merge this branch: bzr merge lp:~alexaubin/unifield-web/US-2937
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+331337@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'addons/openerp/static/javascript/form_state.js'
--- addons/openerp/static/javascript/form_state.js 2017-01-02 14:59:00 +0000
+++ addons/openerp/static/javascript/form_state.js 2017-09-26 07:32:45 +0000
@@ -190,11 +190,19 @@
190}190}
191191
192function list_hookAttrChange(list_name) {192function list_hookAttrChange(list_name) {
193 jQuery('table[id='+list_name+'_grid] [attrs]').each(function () {193
194 var $this = jQuery(this);194 // check if an editor exists
195 var editor_exists = $(".editors").length;
196
197 // Loop on list elements which have an 'attrs' attribute
198 var listgrids = jQuery('table[id='+list_name+'_grid] [attrs]');
199 for (var i = 0 ; i < listgrids.length ; i++)
200 {
201 var elem = listgrids[i];
202 var $this = jQuery(elem);
195 var attrs = $this.attr('attrs') || '{}';203 var attrs = $this.attr('attrs') || '{}';
196 var widget = $this.attr('widget') || '';204 var widget = $this.attr('widget') || '';
197 var container = this;205 var container = elem;
198 var prefix = widget.slice(0, widget.lastIndexOf('/')+1) || '';206 var prefix = widget.slice(0, widget.lastIndexOf('/')+1) || '';
199207
200 // Convert Python statement into it's equivalent in JavaScript.208 // Convert Python statement into it's equivalent in JavaScript.
@@ -207,11 +215,9 @@
207 try {215 try {
208 attrs = eval('(' + attrs + ')');216 attrs = eval('(' + attrs + ')');
209 } catch(e){217 } catch(e){
210 return;218 continue;
211 }219 }
212220
213 // check if an editor exists
214 var editor_exists = $(".editors").length;
215 var cache_values = {};221 var cache_values = {};
216222
217 var row_is_editable = editor_exists && $this.parents('tr.grid-row').is('.editors');223 var row_is_editable = editor_exists && $this.parents('tr.grid-row').is('.editors');
@@ -225,6 +231,7 @@
225 return form_onAttrChange(container, widget, attr, attrs[attr], $this, cache_values);231 return form_onAttrChange(container, widget, attr, attrs[attr], $this, cache_values);
226 }232 }
227 forEach(attrs[attr], function(n) {233 forEach(attrs[attr], function(n) {
234
228 if (typeof(n) == "number") { // {'invisible': [1]}235 if (typeof(n) == "number") { // {'invisible': [1]}
229 return form_onAttrChange(container, widget, attr, n, $this, cache_values);236 return form_onAttrChange(container, widget, attr, n, $this, cache_values);
230 }237 }
@@ -237,7 +244,7 @@
237 return form_onAttrChange(container, widget, attr, attrs[attr], $this, cache_values);244 return form_onAttrChange(container, widget, attr, attrs[attr], $this, cache_values);
238 });245 });
239 }246 }
240 });247 };
241}248}
242249
243function form_onAttrChange(container, widgetName, attr, expr, elem, cache_values) {250function form_onAttrChange(container, widgetName, attr, expr, elem, cache_values) {

Subscribers

People subscribed via source and target branches