Skip to content

Commit

Permalink
[IMP][remove_odoo_enterprise] Hide block title if all the elements of…
Browse files Browse the repository at this point in the history
… the block are hidden
  • Loading branch information
MTantin committed Oct 10, 2023
1 parent 29cb9a9 commit f7132cb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions remove_odoo_enterprise/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Check warning on line 32 in remove_odoo_enterprise/models/res_config_settings.py

View check run for this annotation

Codecov / codecov/patch

remove_odoo_enterprise/models/res_config_settings.py#L32

Added line #L32 was not covered by tests
container.attrib["class"] = "d-none"

ret_val["views"]["form"]["arch"] = etree.tostring(doc)
return ret_val

0 comments on commit f7132cb

Please sign in to comment.