If you don't want to use the "Enter" key, you can use the "+" key from the numpad which is just above.
This is interesting because you keep the default behavior of "Enter" key as long as you don't have "+" character in your field.
If you have it, you can use the other "+" key, which doesn't come with the same keycode.
The only problem is when you type with this key: it adds the character '+' on the field. But you can disable this with this code:
keydown_NUMPAD_ADD: function (e) {
e.preventDefault();
return $.when();
}
In order to have the same behavior of "Tab" key, just use @tolstoj code:
keyup_NUMPAD_ADD: function (e) {
var source_field = $(e.target).closest('[data-fieldname]').attr('data-fieldname');
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) {
e.preventDefault();
return this._next();
}
field = fields[fields_order[field_index]];
} while (!field.$el.is(':visible'));
field.focus();
return $.when();
},
With this, if you switch name field with quantity field in sale orders lines in editable mode for example, behavior will be this:
- Enter product code
- Type "+" numpad key
- Enter quantity
- Type "Enter" numpad key
- And so on...
It will be even better if you have set pricelist, because you just need to enter product's code and quantity and you can create a new record.
This stays in view_list_editable.js so you don't have to worry with other views behavior.
Best regards,
Benjamin