summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2020-03-27 09:39:13 +0000
committerAaron Bohy <aab@odoo.com>2020-03-30 09:06:17 +0000
commit9be9a75e67ac0727e2d5a0f7584f350f4ee638fb (patch)
tree6d3dddf32ee14ffe7ca677c85255f8d24037a776 /addons/web/static/src/js/views/basic
parent63047c1c335b635026e81d2616e55c088e5ae233 (diff)
[REF] web: move _archive function to BasicController
Diffstat (limited to 'addons/web/static/src/js/views/basic')
-rw-r--r--addons/web/static/src/js/views/basic/basic_controller.js19
1 files changed, 19 insertions, 0 deletions
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
@@ -239,6 +239,25 @@ var BasicController = AbstractController.extend(FieldManagerMixin, {
});
},
/**
+ * 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.
*