[IMP] web: inconsistencies between custom button icons in Form views and List View buttons #13983
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the issue/feature this PR addresses:
This PR aims to fix inconsistencies between custom button icons in form views and list views, There is no condition in base.xml to check if the button icon is from an external source or a custom module.
For a better description of what this PR aims to solve please read my answer to this Stackoverflow question
Current behavior before PR:
In a form view we can add a custom icon to a button by specifying the full path to the icon. e.g
<button name="do_stuff" type="object" icon="/my_module/static/src/img/icons/icon.png" />
This is not the same behaviour for List View icons, even if we specify the full path to the icon, Odoo still appends the default icon location path (/web/static/src/img/icons) and .png to the icon location. so we end up with a path like this
<img src="{hostname:port}/web/static/src/img/icons//my_module/static/src/img/icons/icon.png.png" />
To overcome this, you have to use sleazy hacks like this:
<button name="do_stuff" icon="../../../../../my_module/static/src/img/icons/icon" type="object"/>
this would obviously break, because it's a relative link
Note: This problem is also present in 9.0
Desired behavior after PR is merged:
Custom ListView button icons can now be declared the same way you would declare a custom icon for a button in a form view.
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr