From 64f63169ca526bb2e0586908da3f062aa97c93b7 Mon Sep 17 00:00:00 2001 From: Maximilien TANTIN Date: Tue, 10 Oct 2023 16:58:22 +0200 Subject: [PATCH] [IMP][remove_odoo_enterprise] Hide block title if all the elements of the block are hidden --- remove_odoo_enterprise/models/res_config_settings.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/remove_odoo_enterprise/models/res_config_settings.py b/remove_odoo_enterprise/models/res_config_settings.py index 12414775..a461ea40 100644 --- a/remove_odoo_enterprise/models/res_config_settings.py +++ b/remove_odoo_enterprise/models/res_config_settings.py @@ -25,5 +25,12 @@ def get_views(self, views, options=None): for item in doc.xpath(query): item.attrib["class"] = "d-none" + for container in doc.xpath("//div[contains(@class, 'o_settings_container')]"): + if len(container.xpath("div[not(contains(@class, 'd-none'))]")) == 0: + prev_el = container.getprevious() + if len(prev_el) and prev_el.tag == "h2": + prev_el.attrib["class"] = "d-none" + container.attrib["class"] = "d-none" + ret_val["views"]["form"]["arch"] = etree.tostring(doc) return ret_val