From d8261d1162086e5c299e9ee364b7ac0476ea6fee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Sat, 22 Apr 2017 20:56:27 +0200 Subject: [FIX] web: fix issues when deleting records This commit solves two issues with deletion: - deleting the last record in a form view now triggers a history_back action, which means that the view will be changed back to the main view (a list view for example), instead of staying in form view - deleting a record did reload the view twice in some cases. --- addons/web/static/src/js/views/basic/basic_model.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') 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 62898a338bd..e737df9cc9e 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -183,17 +183,14 @@ var BasicModel = AbstractModel.extend({ * parent. * * @todo we should remove the deleted records from the localData - * @todo is it really necessary to reload the data? it seems artificial, and - * the caller should be able to do that himself * @todo why can't we infer modelName? * * @param {string[]} recordIds list of local resources ids. They should all * be of type 'record', and of the same model * @param {string} modelName - * @param {string} parentID * @returns {Deferred} */ - deleteRecords: function (recordIds, modelName, parentID) { + deleteRecords: function (recordIds, modelName) { var self = this; var records = _.map(recordIds, function (id) { return self.localData[id]; }); return this._rpc({ @@ -208,9 +205,6 @@ var BasicModel = AbstractModel.extend({ record.res_id = record.res_ids[record.offset]; record.count--; }); - if (parentID) { - return self.reload(parentID); - } }); }, /** -- cgit v1.2.3