From 9be9a75e67ac0727e2d5a0f7584f350f4ee638fb Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Fri, 27 Mar 2020 09:39:13 +0000 Subject: [REF] web: move _archive function to BasicController --- .../web/static/src/js/views/basic/basic_controller.js | 19 +++++++++++++++++++ 1 file changed, 19 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 8b4672bc291..f5944ffe253 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -238,6 +238,25 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { return _super(dataPointID, changes, event); }); }, + /** + * Archive the current selection + * + * @private + * @param {string[]} ids + * @param {boolean} archive + * @returns {Promise} + */ + _archive: async function (ids, archive) { + if (ids.length === 0) { + return Promise.resolve(); + } + if (archive) { + await this.model.actionArchive(ids, this.handle); + } else { + await this.model.actionUnarchive(ids, this.handle); + } + return this.update({}, {reload: false}); + }, /** * When the user clicks on a 'action button', this function determines what * should happen. -- cgit v1.2.3 From 8608a5ed8dc7d14432556d2c4c469e3f8deda7f1 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Fri, 27 Mar 2020 09:56:50 +0000 Subject: [IMP] web: adapt (un)archive feature to list selection changes Following the new selection feature in list views, this commit adapts the archive and unarchive actions. Part of task 2185145 --- addons/web/static/src/js/views/basic/basic_controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 f5944ffe253..f0fd3cc8c75 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -242,7 +242,7 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { * Archive the current selection * * @private - * @param {string[]} ids + * @param {number[]} ids * @param {boolean} archive * @returns {Promise} */ -- cgit v1.2.3 From 94583df492113211b5ab3afd9d5c25ae1fe30dba Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Fri, 27 Mar 2020 20:18:16 +0000 Subject: [IMP] web: adapt delete feature to list selection changes Following the new selection feature in list views, this commit adapts the delete action. Part of task 2185145 --- addons/web/static/src/js/views/basic/basic_controller.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 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 f0fd3cc8c75..bbfee26e51f 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -346,9 +346,10 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { .then(self._onDeletedRecords.bind(self, ids)); } if (this.confirmOnDelete) { - Dialog.confirm(this, _t("Are you sure you want to delete this record ?"), { - confirm_callback: doIt, - }); + const message = ids.length > 1 ? + _t("Are you sure you want to delete these records?") : + _t("Are you sure you want to delete this record?"); + Dialog.confirm(this, message, { confirm_callback: doIt }); } else { doIt(); } -- cgit v1.2.3