diff options
| author | Julien Mougenot <jum@odoo.com> | 2019-09-17 14:40:31 +0000 |
|---|---|---|
| committer | Julien Mougenot <jum@odoo.com> | 2019-09-18 08:24:32 +0000 |
| commit | ca4e158a8e6de237a929d892910e2182d484c35d (patch) | |
| tree | 11cccd1678862468e1b45fe0d6336c456ac14d3f /addons/web/static/src | |
| parent | 28e52c605d374c20c75b7ff733e08b59e3b7600d (diff) | |
[FIX] web: handling of invalid formats in list views
Added handling of invalid format types in multiple edition in list views.
Before this commit, in multiple edition, a field that was edited with an invalid value format
(e.g. a numeric field receiving a string value) didn't trigger a field_changed and no prompt
was shown; the record was simply idle with an dirty value.
Now, the list controller also listents for set_dirty events and automatically triggers
an error modal + discards all changes when receiving one.
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/views/list/list_controller.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/list/list_controller.js b/addons/web/static/src/js/views/list/list_controller.js index e39c364de52..a74ed7f3dbc 100644 --- a/addons/web/static/src/js/views/list/list_controller.js +++ b/addons/web/static/src/js/views/list/list_controller.js @@ -754,6 +754,29 @@ var ListController = BasicController.extend({ this._toggleSidebar(); }, /** + * If the record is set as dirty while in multiple record edition, + * we want to immediatly discard the change. + * + * @private + * @override + * @param {OdooEvent} ev + */ + _onSetDirty: function (ev) { + var self = this; + var recordId = ev.data.dataPointID; + if (this.renderer.inMultipleRecordEdition(recordId)) { + ev.stopPropagation(); + Dialog.alert(this, _t("No valid record to save"), { + confirm_callback: function () { + self.model.discardChanges(recordId); + self._confirmSave(recordId); + }, + }); + } else { + this._super.apply(this, arguments); + } + }, + /** * When the user clicks on one of the sortable column headers, we need to * tell the model to sort itself properly, to update the pager and to * rerender the view. |
