From 5f3e6fdd9e6aeba8c68ce8b96bb8a50cb01132d8 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 11 Jan 2012 15:02:22 +0100 Subject: [PATCH] [IMP] Disable right click on m2o button bzr revid: fme@openerp.com-20120111140222-cirxtmubrma6qj9b --- .../lib/jquery.contextmenu/jquery.contextmenu.r2.packed.js | 8 +++++--- addons/web/static/src/js/view_form.js | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/web/static/lib/jquery.contextmenu/jquery.contextmenu.r2.packed.js b/addons/web/static/lib/jquery.contextmenu/jquery.contextmenu.r2.packed.js index 2356f3b..47f542e5 100644 --- a/addons/web/static/lib/jquery.contextmenu/jquery.contextmenu.r2.packed.js +++ b/addons/web/static/lib/jquery.contextmenu/jquery.contextmenu.r2.packed.js @@ -65,8 +65,10 @@ display(index,this,e,options); return false; }; - $(this).bind('contextmenu', callback); - if(options.leftClickToo) { + if (!options.noRightClick) { + $(this).bind('contextmenu', callback); + } + if (options.leftClickToo || options.noRightClick) { $(this).click(callback); } return this @@ -123,4 +125,4 @@ })(jQuery); $( function() { $('div.contextMenu').hide() -}); \ No newline at end of file +}); diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 1fca639..85d13f2 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1762,7 +1762,7 @@ openerp.web.form.FieldMany2One = openerp.web.form.Field.extend({ self.open_related(self.related_entries[i]); }; }); - var cmenu = self.$menu_btn.contextMenu(self.cm_id, {'leftClickToo': true, + var cmenu = self.$menu_btn.contextMenu(self.cm_id, {'noRightClick': true, bindings: bindings, itemStyle: {"color": ""}, onContextMenu: function() { if(self.value) { @@ -1782,7 +1782,6 @@ openerp.web.form.FieldMany2One = openerp.web.form.Field.extend({ }); }); var ctx_callback = function(e) {init_context_menu_def.resolve(e); e.preventDefault()}; - this.$menu_btn.bind('contextmenu', ctx_callback); this.$menu_btn.click(ctx_callback); // some behavior for input -- 1.7.10.4