[fix] some bug related to 'enter' button in m2o & editable lists
bzr revid: nicolas.vanhoren@openerp.com-20110712141610-o6h1xa9zb8vfgygi
This commit is contained in:
parent
d3d8c5762c
commit
e96243a12b
|
@ -1321,10 +1321,12 @@ openerp.base.form.FieldMany2One = openerp.base.form.Field.extend({
|
|||
}
|
||||
this.$input.focusout(anyoneLoosesFocus);
|
||||
|
||||
var isSelecting = false;
|
||||
// autocomplete
|
||||
this.$input.autocomplete({
|
||||
source: function(req, resp) { self.get_search_result(req, resp); },
|
||||
select: function(event, ui) {
|
||||
isSelecting = true;
|
||||
var item = ui.item;
|
||||
if (item.id) {
|
||||
self._change_int_value([item.id, item.name]);
|
||||
|
@ -1342,6 +1344,14 @@ openerp.base.form.FieldMany2One = openerp.base.form.Field.extend({
|
|||
minLength: 0,
|
||||
delay: 0
|
||||
});
|
||||
// used to correct a bug when selecting an element by pushing 'enter' in an editable list
|
||||
this.$input.keyup(function(e) {
|
||||
if (e.which === 13) {
|
||||
if (isSelecting)
|
||||
e.stopPropagation();
|
||||
}
|
||||
isSelecting = false;
|
||||
});
|
||||
},
|
||||
// autocomplete component content handling
|
||||
get_search_result: function(request, response) {
|
||||
|
|
Loading…
Reference in New Issue