summaryrefslogtreecommitdiff
path: root/addons/stock/static/src/js
diff options
context:
space:
mode:
authorsvs-odoo <svs@odoo.com>2019-06-04 09:30:03 +0000
committersvs-odoo <svs@odoo.com>2019-06-26 12:30:12 +0000
commit0fa9c07eaa2c8d66ccf7a3d19a35efd1bf2698dc (patch)
tree3e51b05d362685a48f48a9529a1f6d1ae478dfd7 /addons/stock/static/src/js
parent88360a95f2065865c120862518805074d20ae570 (diff)
[FIX] stock: can't select undefined record
Before this commit, on editable quant view list, when user tries to create a duplicate line and save it with tab or enter key, the list tries to go to the next line. But sometime, this line was moved cause of the refresh, so it causes a JS error and raises a traceback. This fix avoid to try to select something in case we refresh the list. Task #2006337 closes odoo/odoo#33866 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Diffstat (limited to 'addons/stock/static/src/js')
-rw-r--r--addons/stock/static/src/js/inventory_singleton_list_controller.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/stock/static/src/js/inventory_singleton_list_controller.js b/addons/stock/static/src/js/inventory_singleton_list_controller.js
index 30bd5c4b22a..b71f2d6ae39 100644
--- a/addons/stock/static/src/js/inventory_singleton_list_controller.js
+++ b/addons/stock/static/src/js/inventory_singleton_list_controller.js
@@ -19,6 +19,8 @@ var _t = core._t;
var SingletonListController = ListController.extend({
/**
* @override
+ * @return {Promise} rejected when update the list because we don't want
+ * anymore to select a cell who maybe doesn't exist anymore.
*/
_confirmSave: function (id) {
var newRecord = this.model.localData[id];
@@ -52,10 +54,11 @@ var SingletonListController = ListController.extend({
var notification = _t("You tried to create a record who already exists."+
"<br/>This last one has been modified instead.");
this.do_notify(_t("This record already exists."), notification);
- return this.reload();
+ this.reload();
+ return Promise.reject();
}
else {
- return this._super(id);
+ return this._super.apply(this, arguments);
}
},
});