[IMP] Disable right click on m2o button
authorFabien Meghazi <fme@openerp.com>
Wed, 11 Jan 2012 14:02:22 +0000 (15:02 +0100)
committerFabien Meghazi <fme@openerp.com>
Wed, 11 Jan 2012 14:02:22 +0000 (15:02 +0100)
bzr revid: fme@openerp.com-20120111140222-cirxtmubrma6qj9b

addons/web/static/lib/jquery.contextmenu/jquery.contextmenu.r2.packed.js
addons/web/static/src/js/view_form.js

index 2356f3b..47f542e 100644 (file)
                 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
 })(jQuery);
 $( function() {
     $('div.contextMenu').hide()
-});
\ No newline at end of file
+});
index 1fca639..85d13f2 100644 (file)
@@ -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