From c04b840a45edd222c50e74d18e2d02a3dd3175cd Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Fri, 5 May 2017 15:21:36 +0200 Subject: [FIX] web: FieldMonetary: don't loose focus after edition ... in x2many editable list views. Field widgets can detect that they are at the origin of a field_changed event, so that they don't re-render themselves when they are being edited. This didn't work for fields inside x2many list views. This wasn't a big problem for most of the fields, because the cursor position was automatically reset after a re-rendering, but it wasn't working for monetary fields that empty their $el before each re-rendering. This rev. fixes the issue by making the field widgets inside x2many list able to detect that they are the origin of a change, and thus removes the now useless code that restore the cursor position. --- addons/web/static/src/js/fields/basic_fields.js | 5 ----- 1 file changed, 5 deletions(-) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index b3defa97911..fc4af105865 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -229,12 +229,7 @@ var InputField = DebouncedField.extend({ type: 'text', placeholder: this.attrs.placeholder || "", }); - // Save cursor position to restore it after updating value - var selectionStart = this.$input[0].selectionStart; - var selectionEnd = this.$input[0].selectionEnd; this.$input.val(this._formatValue(this.value)); - this.$input[0].selectionStart = selectionStart; - this.$input[0].selectionEnd = selectionEnd; return this.$input; }, /** -- cgit v1.2.3