From efe10976a4ae085e905487fdd3479e70788b653a Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Tue, 12 May 2020 09:33:07 +0000 Subject: [FIX] web: correctly update input field after onchange In a form view, have an x2many list with two fields A and B (e.g. A is a many2one, and B is a char). There is an onchange on the x2many that is triggered when the user sets A, and that sets B. In this scenario, let's assume that the user first writes something in B, but directly deletes it. Then, he sets A. Before this commit, in this situation, B wasn't updated with the value returned by the onchange. Indeed, B's field widget was still flagged as 'isDirty', because the user interacted with it, but it didn't commit its value, as it hasn't actually changed. Basically, it remained flagged as 'isDirty' forever, and thus couldn't be updated with the value returned by the onchange. This commit ensures that the 'isDirty' status is correctly updated when the change is actually undone. Task 1958793 closes odoo/odoo#51085 Signed-off-by: Lucas Perais (lpe) Co-authored-by: pka-odoo Co-authored-by: Mohammed Shekha --- addons/web/static/src/js/fields/basic_fields.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 bf225d7ea99..d5f1f1074d4 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -326,7 +326,7 @@ var InputField = DebouncedField.extend({ * @private */ _onInput: function () { - this.isDirty = true; + this.isDirty = !this._isLastSetValue(this.$input.val()); this._doDebouncedAction(); }, /** -- cgit v1.2.3