[FIX] QWeb template inheritance done right

bzr revid: fme@openerp.com-20120201122926-poh3q2157ra9tzjd
This commit is contained in:
Fabien Meghazi
2012-02-01 13:29:26 +01:00
parent a6be92b62b
commit 0839b0e4ee
2 changed files with 7 additions and 30 deletions
+4 -26
View File
@@ -276,10 +276,6 @@ QWeb2.Engine = (function() {
if (xDoc.documentElement.nodeName == "parsererror") {
return this.tools.exception(xDoc.documentElement.childNodes[0].nodeValue);
}
if (xDoc.xml !== undefined) {
// MSIE
return this.convert_xml_to_html(xDoc.documentElement);
}
return xDoc;
} else {
return this.load_xml_string(req.responseText);
@@ -307,25 +303,7 @@ QWeb2.Engine = (function() {
xDoc.async = false;
xDoc.preserveWhiteSpace = true;
xDoc.loadXML(s);
return this.convert_xml_to_html(xDoc.documentElement);
},
convert_xml_to_html: function (node) {
switch (node.nodeType) {
case 3:
case 4:
return document.createTextNode(node.data);
case 8: return document.createComment(node.data);
}
var hnode = document.createElement(node.nodeName);
for(var i=0, alen=node.attributes.length; i < alen; ++i) {
var attr = node.attributes[i];
hnode.setAttribute(attr.name, attr.value);
}
for(var j=0, clen=node.childNodes.length; j < clen; ++j) {
hnode.appendChild(this.convert_xml_to_html(node.childNodes[j]));
}
return hnode;
return xDoc;
},
has_template : function(template) {
return !!this.templates[template];
@@ -431,15 +409,15 @@ QWeb2.Engine = (function() {
this.tools.exception(error_msg + "Invalid operation : '" + operation + "'");
}
operation = {'replace' : 'replaceWith', 'inner' : 'html'}[operation] || operation;
target[operation](this.jQuery(inner));
target[operation](child.cloneNode(true));
} else {
try {
var f = new Function(['$'], inner);
var f = new Function(['$', 'document'], inner);
} catch(error) {
return this.tools.exception("Parse " + error_msg + error);
}
try {
f.apply(target, [this.jQuery]);
f.apply(target, [this.jQuery, template_dest.ownerDocument]);
} catch(error) {
return this.tools.exception("Runtime " + error_msg + error);
}
+3 -4
View File
@@ -680,10 +680,9 @@
<t t-jquery="td.oe-actions">
this.removeAttr('t-if');
var $title = $(document.createElement('h3')).addClass('oe_view_title');
$title.append($(document.createElement('t')).attr(
't-esc', 'fields_view.arch.attrs.string'));
this.prepend($title);
</t>
<t t-jquery="td.oe-actions" t-operation="prepend">
<h3 class="oe_view_title"><t t-esc="fields_view.arch.attrs.string"/></h3>
</t>
</t>
<th t-name="Listview.navigation.button" t-if="!no_leaf and options.pager !== false"