From 8e6a26c42483a275e7639c4ea139ce3b2141598b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Houz=C3=A9fa=20Abbasbhay?= Date: Wed, 24 Apr 2024 18:24:01 +0200 Subject: [PATCH] [IMP] attachment_preview: Disable base Odoo sidebar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Odoo's default attachment sidebar can show up in views with `
`. Our attachment sidebar would show up on top of it, making the base Odoo sidebar obsolete. ➔ We disable it. --- attachment_preview/__manifest__.py | 1 + .../static/src/js/web_views/form_controller.esm.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 attachment_preview/static/src/js/web_views/form_controller.esm.js diff --git a/attachment_preview/__manifest__.py b/attachment_preview/__manifest__.py index 887d5b61..7f3ac68a 100644 --- a/attachment_preview/__manifest__.py +++ b/attachment_preview/__manifest__.py @@ -20,6 +20,7 @@ "attachment_preview/static/src/js/mail_models/attachment_card.esm.js", "attachment_preview/static/src/js/mail_models/attachment_list.esm.js", "attachment_preview/static/src/js/web_views/binary_field.esm.js", + "attachment_preview/static/src/js/web_views/form_controller.esm.js", "attachment_preview/static/src/js/web_views/form_renderer.esm.js", "attachment_preview/static/src/scss/attachment_preview.scss", "attachment_preview/static/src/xml/attachment_preview.xml", diff --git a/attachment_preview/static/src/js/web_views/form_controller.esm.js b/attachment_preview/static/src/js/web_views/form_controller.esm.js new file mode 100644 index 00000000..fece812a --- /dev/null +++ b/attachment_preview/static/src/js/web_views/form_controller.esm.js @@ -0,0 +1,12 @@ +/** @odoo-module **/ +import {FormController} from "@web/views/form/form_controller"; +import {patch} from "@web/core/utils/patch"; + +patch(FormController.prototype, "attachment_preview.FormController", { + /* Defined in addons/mail/static/src/views/form/form_controller.js. + * This method controls Odoo's default attachment sidebar, which only shows + * up based on screen size. ➔ Superseded by this module; we disable it. */ + hasAttachmentViewer() { + return false; + }, +});