[FIX] Watch if jQuery is overwritted by another version in some script. If an override is detected, we check that all old function is always present else we add the missing.

The problem was that some websites uses externals libraries which use a jQuery more recent that our version. Jquery by default  checks his own version  and overwrite itself if the current version is lower.
Once user had their jquery overwritted, function dropdown was missing and it was impossible to the end user to get menu working again... and so impossible to remove the view with the front end.

bzr revid: jke@openerp.com-20140414151423-zhi3tjj52rihltzy
This commit is contained in:
Kersten Jeremy 2014-04-14 17:14:23 +02:00
parent 65a6b922b5
commit a8ce5415ad
1 changed files with 12 additions and 0 deletions

View File

@ -43,6 +43,7 @@
t-att-data-view-xmlid="xmlid if editable else None"
t-att-data-main-object="repr(main_object) if editable else None">
<head>
<script type="text/javascript" src="/web/static/js/watch.js"></script>
<t t-if="main_object and 'website_meta_title' in main_object">
<t t-set="title" t-value="main_object.website_meta_title"/>
</t>
@ -73,6 +74,17 @@
// Bootstrap and jQuery UI conflicts
$.fn.bstooltip = $.fn.tooltip;
$.fn.bsbutton = $.fn.button;
// keep jQuery method alive
window.watch("$", function (prop, oldval, val) {
console.debug("jQuery "+oldval.fn.jquery+" overwritted by jQuery "+val.fn.jquery);
for (var i in oldval.fn) {
if (typeof val.fn[i] === "undefined") {
val.fn[i] = oldval.fn[i];
}
}
return val;
});
</script>
<script type="text/javascript" src="/web/static/lib/qweb/qweb2.js"></script>