[16.0][FIX] remove_odoo_enterprise: Fixed the logic to hide enterprise setings, to prevent broken settings views.
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
This situation is not handled properly in remove_odoo_enterprise and the result is a broken / empty form:
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
- Install remove_odoo_enterprise and website_slides
- Open the settings for "eLearning" --> Form is empty
- Type something in the res settings search bar --> Error message appears
@pedrobaeza @remi-filament Kindly asking for a review :)
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 :
d-none classes are not applied on h2 titles :
Which is strange because you get it when requesting the view :
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.
@remi-filament Kindly asking for another review 😊
On my way to merge this fine PR! Prepared branch 16.0-ocabot-merge-pr-98-by-pedrobaeza-bump-patch, awaiting test results.
Congratulations, your PR was merged at 6ba0e879ae21ad660626dfb5193c76b2cfe025cf. Thanks a lot for contributing to OCA. ❤️