I use this code for making enter key work as tab, but sometimes don't work.
please help.
keyup_ENTER: function (e) {
var form = this.editor.form;
var last_field = _(form.fields_order).chain()
.map(function (name) { return form.fields[name]; })
.filter(function (field) { return field.$el.is(':visible'); })
.last()
.value();
// tabbed from last field in form
if (last_field && $(e.target).closest(last_field.el).length) {
e.preventDefault();
return this._next();
}
var source_field = $(e.target).closest('[data-fieldname]')
.attr('data-fieldname');
var cursor = this._text_cursor(e.target);
var fields_order = this.editor.form.fields_order;
var field_index = _(fields_order).indexOf(source_field);
var fields = this.editor.form.fields;
var field;
do {
if (++field_index >= fields_order.length) { return $.when(); }
field = fields[fields_order[field_index]];
} while (!field.$el.is(':visible') || field.$el.is("span[class='o_form_field o_readonly']"));
field.focus().select();
return $.when();
},