From 9a9da5763b38a3bce54e9c4870af0032e38cacc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Wed, 4 Apr 2018 10:09:33 +0200 Subject: [FIX] web: no record abandon on discard from default_get/onchange Before this commit, when some records were created from an `onchange`, we have the following weird behaviour: Suppose that this record has some required fields that are empty. When we click on this record, then somewhere else, the record disappears from the list. This is because the records contains invalid fields, and it is wrongfully assuming that the record to be discarded comes from "Add an item". A previous commit [1] fixed a bit this issue with `default_get`, but since it relied on a fragile heuristic, we decide to apply the correct fix with this commit. [1] https://github.com/odoo/odoo/commit/b09f0c99be2b13d33986414485556d87da186d65 --- addons/web/static/src/js/views/basic/basic_controller.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (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 93b8d1ce82d..2ab0e276389 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -338,10 +338,8 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { return; } self.model.discardChanges(recordID); - if (self.model.isNew(recordID)) { - if (self.model.canBeAbandoned(recordID)) { - self._abandonRecord(recordID); - } + if (self.model.canBeAbandoned(recordID)) { + self._abandonRecord(recordID); return; } return self._confirmSave(recordID); -- cgit v1.2.3