[FIX] web_decimal_numpad_dot: Restore keyboard navigation

When https://github.com/OCA/web/pull/1154 switched to using `keydown` as the event to trigger the numpad dot replacement, it was actually [disabling upstream's `_onKeyDown()`][1], which in turn disabled the keyboard navigation.

To fix this situation, I replaced the method that is being used to directly override `_onKeyDown`.

[1]: 19558129f0/addons/web/static/src/js/fields/abstract_field.js (L41)
This commit is contained in:
Jairo Llopis
2019-01-18 07:33:45 +00:00
committed by João Marques
parent 301cd189cf
commit e2a42ff4af
2 changed files with 3 additions and 10 deletions

View File

@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Web - Numpad Dot as decimal separator</title>
<style type="text/css">

View File

@@ -7,13 +7,6 @@ odoo.define("web_decimal_numpad_dot.FieldFloat", function (require) {
var translation = require("web.translation");
var NumpadDotReplaceMixin = {
init: function () {
this.events = $.extend({}, this.events, {
"keydown": "numpad_dot_replace",
});
return this._super.apply(this, arguments);
},
l10n_decimal_point: function () {
return this.formatType === "float_time"
? ":" : translation._t.database.parameters.decimal_point;
@@ -24,10 +17,10 @@ odoo.define("web_decimal_numpad_dot.FieldFloat", function (require) {
cur_val.substring(to);
},
numpad_dot_replace: function (event) {
_onKeydown: function (event) {
// Only act on numpad dot key
if (event.keyCode !== 110) {
return;
return this._super.apply(this, arguments);
}
event.preventDefault();
var from = this.$input.prop("selectionStart"),