diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index aba6eaea261..b578ad0bc32 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -739,7 +739,7 @@ openerp.web.FormRenderingEngine = openerp.web.Widget.extend({ var xml = openerp.web.json_node_to_xml(fvg.arch); this.$form = $(xml); - this.process_any(this.$form); + this.process(this.$form); }, start: function() { var self = this; @@ -770,32 +770,23 @@ openerp.web.FormRenderingEngine = openerp.web.Widget.extend({ this.$element.toggleClass('oe_layout_debugging'); }, - process_any: function($tag) { + process: function($tag) { var self = this; - // TODO: extract embeded views before preprocessing var tagname = $tag[0].nodeName.toLowerCase(); var fn = self['process_' + tagname]; if (this.registry && this.registry.contains(tagname)) { fn = this.registry.get_object(tagname); } - if (fn) - fn.call(self, $tag); - else { // generic tag handling, just process children - _.each($tag.children(), function(el) { - self.process_any($(el)); + if (fn) { + var args = [].slice.call(arguments); + args[0] = $tag; + fn.apply(self, args); + } else { + // generic tag handling, just process children + $tag.children().each(function() { + self.process($(this)); }); } - /* - _.each(['field', 'group', 'notebook', 'separator', 'label'], function(tag) { - var fn = self['process_' + tag]; - if (this.registry && this.registry.contains(tag)) { - fn = this.registry.get_object(tag); - } - $form.find(tag).each(function() { - fn.call(self, $(this), $form); - }); - }); - */ }, process_field: function($field, no_process_label) { var name = $field.attr('name'), @@ -813,14 +804,15 @@ openerp.web.FormRenderingEngine = openerp.web.Widget.extend({ if (!$label.length) { field_string = $label.attr('string') || $label.text() || field_string; field_help = $label.attr('help') || field_help; - var label = $('