In odoo 16 I cannot add buttons to the top of list view. I have seen several treads about this issue online - all with no solution. please help me with right direction to solve this issue.
16 - latest version from repo
https://monosnap.com/file/zyMHtPbDvhMmtryBeXON0dM8hnQ4WQ
ListView.buttons
with extra buttons. Let's do it!mu_module/static/src/xml/my_buttons.xml
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-extend="ListView.buttons" t-name="my_button_extension.buttons">
<t t-jquery="button.o_list_button_add" t-operation="after">
<button class="btn btn-primary import_your_action">
Jump1
</button>
</t>
</t>
</templates>
__manifest__.py
add the following block of code: 'assets': {
'web.assets_backend': [
'static/src/xml/my_buttons.xml',
],
},
Odoo system returns an error:
UncaughtPromiseError
Uncaught Promise > QWeb2: Can't clone undefined template 'ListView.buttons' to create 'my_button_extension.buttons'
Error: QWeb2: Can't clone undefined template 'ListView.buttons' to create 'my_button_extension.buttons'
at Object.exception (http://localhost:8069/web/assets/20-aacf356/web.assets_common.min.js:5526:7)
at Engine.add_template (http://localhost:8069/web/assets/20-aacf356/web.assets_common.min.js:5542:361)
at http://localhost:8069/web/assets/20-aacf356/web.assets_common.min.js:5601:97
In every tree/list view will appear button wuth text "Jump1".
The only real difference between the enterprise module hr_expense
and your approach i can see, is the file path for the assets. I took the module hr_expense
because it is extending the listview buttons ;-)
In Odoo's manifest the paths start with the module's name:
'assets': {
'web.assets_backend': [
'my_button_extension/static/src/xml/my_buttons.xml',
],
},
Another hint: add web
module as dependency to your manifest.