From 776bac6a069fc1ef2d6bea0e85a0737e3cefecef Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Sat, 30 Sep 2017 10:50:41 +0200 Subject: [FIX] web: don't discard x2many rows coming from default_get Problem occured in the MRP Production wizard (with a consumed product tracked by serial number). The opened record is a new record, and its one2many has 2 default rows that are prefilled. If the user edited one of the quantities in those rows, and set an invalid value instead (e.g. a letter), the row was removed without notice when it was focused out. This was because the model wasn't aware that a change has been done on the record, and as the record was flagged as new, it was simply abandonned. --- addons/web/static/src/js/views/basic/basic_controller.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'addons/web/static/src/js/views/basic/basic_controller.js') 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 481fc0cf4dd..c899530de07 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -19,6 +19,7 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { custom_events: _.extend({}, AbstractController.prototype.custom_events, FieldManagerMixin.custom_events, { discard_changes: '_onDiscardChanges', reload: '_onReload', + set_dirty: '_onSetDirty', sidebar_data_asked: '_onSidebarDataAsked', translate: '_onTranslate', }), @@ -553,6 +554,14 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { }); } }, + /** + * @private + * @param {OdooEvent} ev + */ + _onSetDirty: function (ev) { + ev.stopPropagation(); // prevent other controllers from handling this request + this.model.setDirty(ev.data.dataPointID); + }, /** * Handler used to get all the data necessary when a custom action is * performed through the sidebar. -- cgit v1.2.3