summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-07-26 11:27:11 +0200
committerGéry Debongnie <ged@odoo.com>2017-07-27 11:34:04 +0200
commit72ed3a153a1f4c718fee33ac8550298e8a29f6cd (patch)
treecdc06e861ab8ad9a0c221f8ea6ba1093e857f295 /addons/web/static/src/js/fields
parent3d6420d4b3f062f12d7c18d7d9a976e2299b3444 (diff)
[FIX] web,pad: record is not considered dirty when pad is loaded
The pad widget does something unconventional: it creates the pad url only when rendering in edit mode. This was done to prevent creating pad by default for record in readonly mode. Because of that, if the user clicks on create, then discard, the record was considered dirty, so a confirmation modal popped up. In this commit, we just make sure that the initial setValue from the rendering does not 'dirty' the record.
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/abstract_field.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/addons/web/static/src/js/fields/abstract_field.js b/addons/web/static/src/js/fields/abstract_field.js
index fa2f37a123f..426d42d664b 100644
--- a/addons/web/static/src/js/fields/abstract_field.js
+++ b/addons/web/static/src/js/fields/abstract_field.js
@@ -379,6 +379,11 @@ var AbstractField = Widget.extend({
* @private
* @param {any} value
* @param {Object} [options]
+ * @param {boolean} [options.doNotSetDirty=false] if true, the basic model
+ * will not consider that this field is dirty, even though it was changed.
+ * Please do not use this flag unless you really need it. Our only use
+ * case is currently the pad widget, which does a _setValue in the
+ * renderEdit method.
* @param {boolean} [options.forceChange=false] if true, the change event will be
* triggered even if the new value is the same as the old one
* @returns {Deferred}
@@ -407,6 +412,7 @@ var AbstractField = Widget.extend({
dataPointID: this.dataPointID,
changes: changes,
viewType: this.viewType,
+ doNotSetDirty: options && options.doNotSetDirty,
onSuccess: def.resolve.bind(def),
onFailure: def.reject.bind(def),
});