From 50d2f188f80fd5f13f72b352962ec12e099b8751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Lef=C3=A8vre?= Date: Mon, 9 Sep 2019 14:57:04 +0000 Subject: [PATCH] [FIX] web: Display archive action if active in view Since ee5e972, "Achive" and "Unarchive" actions are automatically displayed in the actions dropdown if the record has an `active` field. The "Archive" action is shown if `active=True`, and "Unarchive" otherwise. However, if the record has the `active` field but it's not in the view, the form controller think `active=False` because `undefined` is falsy. Therefore, the "Unarchive" action is always shown. If `active` is not in the view, neither "Archive" nor "Unarchive" should be shown. closes odoo/odoo#36551 Signed-off-by: Yannick Tivisse (yti) --- addons/web/static/src/js/views/form/form_controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views/form/form_controller.js b/addons/web/static/src/js/views/form/form_controller.js index 3ecd38cfe45..22de0e8d68b 100644 --- a/addons/web/static/src/js/views/form/form_controller.js +++ b/addons/web/static/src/js/views/form/form_controller.js @@ -186,7 +186,7 @@ var FormController = BasicController.extend({ var self = this; if (this.hasSidebar) { var otherItems = []; - if (this.archiveEnabled) { + if (this.archiveEnabled && this.initialState.data.active !== undefined) { var classname = "o_sidebar_item_archive" + (this.initialState.data.active ? "" : " o_hidden") otherItems.push({ label: _t("Archive"),