[FIX] Remove fvg steps from form view

bzr revid: fme@openerp.com-20121205093522-4mws91b2i14f7j1z
This commit is contained in:
Fabien Meghazi 2012-12-05 10:35:22 +01:00
parent c867595eed
commit 595ba7a799
1 changed files with 5 additions and 22 deletions

View File

@ -1189,36 +1189,19 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt
});
}
},
view_arch_to_dom_node: function(arch) {
// Historic mess for views arch
//
// server:
// -> got xml as string
// -> parse to xml and manipulate domains and contexts
// -> convert to json
// client:
// -> got view as json
// -> convert back to xml as string
// -> parse it as xml doc (manipulate button@type for IE)
// -> convert back to string
// -> parse it as dom element with jquery
// -> for each widget, convert node to json
//
// Wow !!!
var xml = instance.web.json_node_to_xml(arch);
var doc = $.parseXML('<div class="oe_form">' + xml + '</div>');
get_arch_fragment: function() {
var doc = this.fvg.arch_doc.documentElement.cloneNode(true);
// IE won't allow custom button@type and will revert it to spec default : 'submit'
$('button', doc).each(function() {
$(this).attr('data-button-type', $(this).attr('type')).attr('type', 'button');
});
xml = instance.web.xml_to_str(doc);
return $(xml);
return $('<div class="oe_form"/>').append(doc);
},
render_to: function($target) {
var self = this;
this.$target = $target;
this.$form = this.view_arch_to_dom_node(this.fvg.arch);
this.$form = this.get_arch_fragment();
this.process_version();