Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: QWeb widget templates - unable to use extension inheritance mode?

by
MoaHub, Graeme Gellatly
- 06/08/2020 12:43:48
I never did it that way. I'm no expert but usually I use t-jquery t-operation t-extend style syntax.

On Thu, 6 Aug 2020, 9:26 pm Radovan Skolnik, <radovan@skolnik.info> wrote:

Hello,

 

I am working on a module that would allow to assgin icons to website menus to be rendered in custom theme. This is what I achieved:

 

Everything works as expected but I stumbled to template inheritance issue on the first widget - that is template: 'website.contentMenu.dialog.edit' defined in /addons/website/static/src/xml/website.contentMenu.xml For individual menu items it uses recursively template 'website.contentMenu.dialog.submenu' that has no JavaScript object associated. Now I wanted to use extension inheritance to alter content of this sub-template to render image/icon. So my aim was to use something like this:

 

<t t-inherit="website.contentMenu.dialog.submenu" t-inherit-mode="extension">

<xpath expr="//span[hasclass('input-group-append')]" position="inside">

<button type="button" t-att-class="submenu.fields['image']" aria-label="Menu Image" title="Menu Image"/>

</xpath>

</t>

 

Now whetever I tried this didn't work for me. I also tried to use something similar on the main template which is used by my JavaScript object extended from original. Didn't work as well. If it took my template it would generate into HTML literally the content of outer <t> tag - so the HTML contained tags <xpath expr="..."> and so on.

 

I solved it temporarily but copying both templates into my own file and modified them. But I would love to make this more elegant and extend the templates in-place as stated in documentation. Has anyone some experience with this? In all of the source code of Odoo 13.0, 12.0 and 11.0 I didn't find a single use of this feature for a reference.

 

Thank you for any help. Best regards

 

Radovan Skolnik

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

Reference