summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic
diff options
context:
space:
mode:
authorVincent Schippefilt <vsc@odoo.com>2018-09-03 16:20:06 +0200
committerVincent Schippefilt <vsc@odoo.com>2018-09-25 16:49:22 +0200
commite343f5f5f95607b91a61fed167a6f11f0eeaeaa8 (patch)
treed9cc4b8ff39fedc17db36c7f1ed3fbc1fea2ec5f /addons/web/static/src/js/views/basic
parent3dcf20284df9fb411a7093537ccd645a34543b20 (diff)
[IMP] web: x2many adds a new line by tabbing on a not dirty line
Before this change, when the focus was on the first field on a x2many field, and the user pressed TAB, the line would be discarded and the focus moved to the next field (at the level of the x2many) in the form. This was an issue because if the first field was required, the focus could not be moved out of the field with TAB so the user had to discard the line manually (with ESC) before moving to the next field This change works with 2 changes: 1. detecting if a line is dirty (has been modified by the user) and at the end of the line, decide to either - discard the line and move the next field, if the line is not dirty - commit the line and add a new line, if the line is dirty 2. allow users to use TAB through required field inside x2many so they can easilly go to the end of the line. Task id : 1872248
Diffstat (limited to 'addons/web/static/src/js/views/basic')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js
index fbb4b0b122c..9dd7c4d1141 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -594,6 +594,7 @@ var BasicModel = AbstractModel.extend({
getDomain: element.getDomain,
getFieldNames: element.getFieldNames,
id: element.id,
+ isDirty: element.isDirty,
limit: element.limit,
model: element.model,
offset: element.offset,
@@ -648,6 +649,7 @@ var BasicModel = AbstractModel.extend({
getFieldNames: element.getFieldNames,
groupedBy: element.groupedBy,
id: element.id,
+ isDirty: element.isDirty,
isOpen: element.isOpen,
limit: element.limit,
model: element.model,
@@ -3490,6 +3492,7 @@ var BasicModel = AbstractModel.extend({
dataPoint.getContext = this._getContext.bind(this, dataPoint);
dataPoint.getDomain = this._getDomain.bind(this, dataPoint);
dataPoint.getFieldNames = this._getFieldNames.bind(this, dataPoint);
+ dataPoint.isDirty = this.isDirty.bind(this, dataPoint.id);
this.localData[dataPoint.id] = dataPoint;