From a8ce5415ad94b67f97e09077bb7e32939d52e538 Mon Sep 17 00:00:00 2001 From: Kersten Jeremy Date: Mon, 14 Apr 2014 17:14:23 +0200 Subject: [PATCH] [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 --- addons/website/views/website_templates.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index ea4ba359c5f..2621ec176dd 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -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"> + @@ -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; + });