Mohammed Shekha(Open ERP) has proposed merging
lp:~openerp-dev/openobject-client-web/6.0-opw-573038-msh into
lp:openobject-client-web.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-573038-msh/+merge/99918
Hello,
Fixed the issue of many2one widget which opens two popup as well as fixed the
issue of many2one search result SelectionBox was not closed.
There were basically two issue.
1. When you enter any text in many2one and without making mouseover to search
result in SelectionBox(i.e. small popup below the many2one field) directly
opens the search popup by clicking search image, you will see there will be two
many2one search popup opens.
2. When you enter any text in many2one and make mouseover to SelectionBox
results and then open the search popup by clicking on search image and select
any record from that search popup you will the SelectionBox still there.
Reason :-
1 issue : The two popup are opened because there are lostfocus, getfocus,
onClick etc events are binded with many2one widget.
Now when you enters some text in many2one and click on the search image for
opening search popup at that time two events will be called,
1 lostfocus (i.e. lostFocus function)
2 onClick(i.e. select function)
And both the function are calling get_matched which opens search popup,
2 Issue : Here issue is that when mouseover occurs at that we set
"suggestionBoxMouseOver" to true but nowhere we have set it false, so once it
is set to true it will not be set to false after ward.
Hence changed the code to fix this both issue.
Thanks.
--
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-573038-msh/+merge/99918
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-client-web/6.0-opw-573038-msh.
=== modified file 'addons/openerp/static/javascript/m2o.js'
--- addons/openerp/static/javascript/m2o.js 2012-03-22 11:40:02 +0000
+++ addons/openerp/static/javascript/m2o.js 2012-03-29 12:22:18 +0000
@@ -56,6 +56,7 @@
this.selectedResult = false;
this.eval_domain = null;
this.eval_context = null;
+ this.blured = false;
this.select_img = openobject.dom.get(name + '_select');
this.open_img = openobject.dom.get(name + '_open');
@@ -111,6 +112,7 @@
if(!this.suggestionBoxMouseOver && this.text.value && !this.field.value) {
// clicked outside the box, with some text entered
// do as if tabbed out
+ this.blured = true;
this.lastKey = null;
this.get_matched();
this.clearResults();
@@ -121,7 +123,10 @@
if(this.field.disabled) {
return;
}
- if(!jQuery(this.field).hasClass('readonlyfield')) {
+ if(!this.text.value || this.suggestionBoxMouseOver){
+ this.blured = false;
+ }
+ if(!jQuery(this.field).hasClass('readonlyfield') && !this.blured) {
this.get_matched();
}
};
@@ -426,6 +431,7 @@
jQuery(idSelector(id + '_text')).val('');
}
open_search_window(m2o.relation, domain, context, m2o.name, 1, text);
+ m2o.clearResults();
}
}, 'json');
});
@@ -508,6 +514,7 @@
var mouseOver = jQuery.proxy(this, 'getMouseover');
var onClick = jQuery.proxy(this, 'getOnclick');
+ var mouseOut = jQuery.proxy(this, 'getMouseout');
var rowName = "autoComplete" + this.name + "_";
var $resultsTable = jQuery('<tbody>').appendTo($fancyTable);
jQuery.each(result.values, function (i, currentObject) {
@@ -516,7 +523,8 @@
"name": rowName + i,
"id": rowName + i,
"mouseover": mouseOver,
- "click": onClick
+ "click": onClick,
+ "mouseout":mouseOut
}).append(jQuery('<td>', {
'data-id':currentObject[0],
'class': 'm2o_coplition'
@@ -568,6 +576,10 @@
this.updateSelectedResult();
};
+ManyToOne.prototype.getMouseout = function() {
+ this.suggestionBoxMouseOver = false;
+};
+
ManyToOne.prototype.getOnclick = function(evt) {
evt.which = 13;
this.on_keydown(evt);
_______________________________________________
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