Mohammed Shekha(Open ERP) has proposed merging
lp:~openerp-dev/openerp-web/6.1-opw-579519-msh into lp:openerp-web/6.1.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/6.1-opw-579519-msh/+merge/126388
Hello,
Fixed the issue of blur and focus event binded on many2one menu button, here
when you open context menu in editable one2many and click any option of the
context will call save for current row.
Reason :- We bind the focus and blur of menu button of context menu, so when we
click inside context menu will call blur for the menu button, and focus is not
set to other widget of current row hence it will call form-blur and form-blur
in turn call save for current row.
Hence manually bind the focus and blur for menu button of context menu instead
of setupFocus, and ignore the blur when context menu clicked.
Thanks.
--
https://code.launchpad.net/~openerp-dev/openerp-web/6.1-opw-579519-msh/+merge/126388
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openerp-web/6.1-opw-579519-msh.
=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js 2012-09-24 15:26:28 +0000
+++ addons/web/static/src/js/view_form.js 2012-09-26 06:46:37 +0000
@@ -2035,6 +2035,7 @@
this.$input = this.$element.find("input");
this.$drop_down = this.$element.find(".oe-m2o-drop-down-button");
this.$menu_btn = this.$element.find(".oe-m2o-cm-button");
+ var $self = $(self), ignore_blur = false;
// context menu
var init_context_menu_def = $.Deferred().then(function(e) {
@@ -2084,6 +2085,7 @@
var cmenu = self.$menu_btn.contextMenu(self.cm_id, {'noRightClick': true,
bindings: bindings, itemStyle: {"color": ""},
onContextMenu: function() {
+ ignore_blur = true;
if(self.value) {
$("#" + self.cm_id + " .oe_m2o_menu_item_mandatory").removeClass("oe-m2o-disabled-cm");
} else {
@@ -2102,7 +2104,13 @@
});
var ctx_callback = function(e) {init_context_menu_def.resolve(e); e.preventDefault()};
this.$menu_btn.click(ctx_callback);
-
+ this.$menu_btn.bind({
+ focus: function () { $self.trigger('widget-focus'); },
+ blur: function () {
+ if(ignore_blur){ return; }
+ $self.trigger('widget-blur');
+ }
+ });
// some behavior for input
this.$input.keyup(function() {
if (self.$input.val() === "") {
@@ -2142,7 +2150,6 @@
}
}
};
- var $self = $(self), ignore_blur = false;
this.$input.bind({
focusout: anyoneLoosesFocus,
focus: function () { $self.trigger('widget-focus'); },
@@ -2193,7 +2200,6 @@
}
});
- this.setupFocus(this.$menu_btn);
},
// autocomplete component content handling
get_search_result: function(request, response) {
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp