diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-09-17 12:07:26 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-09-17 12:07:26 +0200 |
| commit | 3117afbb7e4a4a762ff041f7797250d3b3bd9a05 (patch) | |
| tree | e3dd22e4482d756684b58da442cafa490abadb04 /addons/web/static/src/js/views/basic | |
| parent | e82a9ae0e1588799cb9bbe9062ef79cf8711b016 (diff) | |
| parent | 4e85ca8a76dc2be4da805fd0aa83ef5227ce44ab (diff) | |
[MERGE] forward port branch saas-11.5 up to 4e85ca8a76d
Diffstat (limited to 'addons/web/static/src/js/views/basic')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_controller.js | 11 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_model.js | 4 |
2 files changed, 9 insertions, 6 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 5767969d15c..43d604eac0b 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -173,18 +173,21 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { // 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 + // changes and these are also protected. However, we must wait for the + // mutex to be idle to ensure that onchange RPCs returned before asking + // field widgets to commit their value (and validate it, for instance + // for one2many with required fields). 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. var self = this; - return this.mutex - .exec(this.renderer.commitChanges.bind(this.renderer, recordID || this.handle)) - .then(function () { + return this.mutex.getUnlockedDef().then(function () { + return self.renderer.commitChanges(recordID || self.handle).then(function () { return self.mutex.exec(self._saveRecord.bind(self, recordID, options)); }); + }); }, /** * @override 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 c095871b75d..fbb4b0b122c 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -2570,11 +2570,11 @@ var BasicModel = AbstractModel.extend({ } var def = $.Deferred(); - + var evalContext = this._getEvalContext(record); this._rpc({ model: domainModel, method: 'search_count', - args: [Domain.prototype.stringToArray(domainValue)], + args: [Domain.prototype.stringToArray(domainValue, evalContext)], context: context }) .then(_.identity, function (error, e) { |
