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