server-brand icon indicating copy to clipboard operation
server-brand copied to clipboard

[16.0][FIX] remove_odoo_enterprise: Fixed the logic to hide enterprise setings, to prevent broken settings views.

Open baguenth opened this issue 8 months ago • 3 comments

Issue

The current logic in remove_odoo_enterprise regarding the res settings is not robust enough and therefore can lead to unexpected behaviours, if settings forms do not exactly look like expected.

One concrete example: remove_odoo_enterprise breaks the settings view of odoo core module website_slides. There they use groups as first element in settings_container

image

This situation is not handled properly in remove_odoo_enterprise and the result is a broken / empty form:

image

And also the search is broken. When typing something in the search bar, an js error occurs:

OwlError: An error occured in the owl lifecycle (see this Error's "cause" property) OwlError@ handleError@http://oca-server-brand-16-0-749361a09185.runboat.odoo-community.org/web/assets/780-8b11573/web.assets_common.min.js:1484:113 _render@http://oca-server-brand-16-0-749361a09185.runboat.odoo-community.org/web/assets/780-8b11573/web.assets_common.min.js:1509:30 render@http://oca-server-brand-16-0-749361a09185.runboat.odoo-community.org/web/assets/780-8b11573/web.assets_common.min.js:1507:13 @http://oca-server-brand-16-0-749361a09185.runboat.odoo-community.org/web/assets/780-8b11573/web.assets_common.min.js:1597:35

Caused by: TypeError: undefined is not an object (evaluating 'this.state.showAllContainer.showAllContainer') visible@http://oca-server-brand-16-0-749361a09185.runboat.odoo-community.org/web/assets/1036-fbf7917/web.assets_backend.min.js:6215:31 template@ _render@http://oca-server-brand-16-0-749361a09185.runboat.odoo-community.org/web/assets/780-8b11573/web.assets_common.min.js:1508:104 render@http://oca-server-brand-16-0-749361a09185.runboat.odoo-community.org/web/assets/780-8b11573/web.assets_common.min.js:1507:13 @http://oca-server-brand-16-0-749361a09185.runboat.odoo-community.org/web/assets/780-8b11573/web.assets_common.min.js:1597:35

Solution

Make the code more robust.

Steps to reproduce

  1. Install remove_odoo_enterprise and website_slides
  2. Open the settings for "eLearning" --> Form is empty
  3. Type something in the res settings search bar --> Error message appears

baguenth avatar Apr 29 '25 13:04 baguenth

@pedrobaeza @remi-filament Kindly asking for a review :)

baguenth avatar Apr 29 '25 14:04 baguenth

Hi @baguenth thank you for looking into that ! I have just tested it on runboat and it seems that titles (with h2 tags) are not hidden : image

d-none classes are not applied on h2 titles : image

Which is strange because you get it when requesting the view : image

remi-filament avatar May 05 '25 14:05 remi-filament

Hi @remi-filament,

thank you for your feedback :)

I figured out the issue is with preserving the original classes (which I thought would be the safer approach) instead of entirely overwriting them with "d-none". Seems like Odoo sometimes keeps the element in the view, in case they have other classes along with "d-none".

Solution was to use the old approach of entirely overwriting the classes with "d-none". Updated the code.

baguenth avatar May 07 '25 14:05 baguenth

@remi-filament Kindly asking for another review 😊

baguenth avatar May 26 '25 19:05 baguenth

On my way to merge this fine PR! Prepared branch 16.0-ocabot-merge-pr-98-by-pedrobaeza-bump-patch, awaiting test results.

OCA-git-bot avatar May 27 '25 18:05 OCA-git-bot

Congratulations, your PR was merged at 6ba0e879ae21ad660626dfb5193c76b2cfe025cf. Thanks a lot for contributing to OCA. ❤️

OCA-git-bot avatar May 27 '25 18:05 OCA-git-bot