diff options
| author | qsm-odoo <qsm@odoo.com> | 2017-05-05 11:01:53 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2017-05-05 15:58:43 +0200 |
| commit | ac490b1b3e4d9c74b8d4de281b8fd511874d7d6c (patch) | |
| tree | e0d3ec6a4f61fa79040db578109571382704aca7 /addons/web/static/src/js/views/basic/basic_controller.js | |
| parent | 3118c837e3afd17c4a281290248f04c1b6ad5a4b (diff) | |
[FIX] web: better factorize debounced/input fields code
`DebouncedField` and `InputField` classes were not properly factorized,
some of the DebouncedField code had to be part of the `InputField`
class (which is a specialization of `DebouncedField`). Indeed the
`FieldText` class, specialization of `DebouncedField` class, was missing
properties which were part of `InputField` and was duplicating code
which was already defined in `InputField`.
For example, it was not possible to navigate out of text fields in
editable list views with the right/left keys as this was part of the
`InputField` class.
Note: the FieldTextHtmlSimple class was implementing the `commitChanges`
function differently than `DebouncedField` but this was in fact not
necessary. This is why documentation update has also been done for this
by this commit.
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_controller.js')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_controller.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_controller.js b/addons/web/static/src/js/views/basic/basic_controller.js index 87e8d1a6664..b7cd40d9e7c 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -166,15 +166,16 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { * @returns {Deferred} */ saveRecord: function (recordID, options) { - // Some field widgets (e.g. 'html') can't detect (all) their changes, so - // we ask them to commit their current value before saving. This has to - // be done outside of the mutex protection of saving because - // commitChanges will trigger changes and these are also protected. So - // the actual saving has to be done after these changes. Also the - // commitChanges operation might not be synchronous for other reason - // (e.g. the x2m fields will ask the user if some discarding has to be - // made). This operation must also be mutex-protected as commitChanges - // function of x2m has to be aware of all final changes made to a row. + // Some field widgets can't detect (all) their changes immediately or + // may have to validate them before notifying them, so we ask them to + // commit their current value before saving. This has to be done outside + // of the mutex protection of saving because commitChanges will trigger + // changes and these are also protected. So the actual saving has to be + // done after these changes. Also the commitChanges operation might not + // be synchronous for other reason (e.g. the x2m fields will ask the + // user if some discarding has to be made). This operation must also be + // mutex-protected as commitChanges function of x2m has to be aware of + // all final changes made to a row. this.mutex.exec(this.renderer.commitChanges.bind(this.renderer, recordID || this.handle)); // TODO write a test for this return this.mutex.exec(this._saveRecord.bind(this, recordID, options)); }, |
