Odoo Help


Is there a non-hack way to add my own QWeb directives?

Konstantinos Metaxas
on 10/10/15, 3:23 AM 473 views

I come from a Django background and an app can register template directives and they are available to all other apps (there is a central registry basically).  Is there a way for my app to register a  new Qweb directive/tag?

For example i may want to create something like: <t thumbnail="{'image':o.image,'format':'90x90 bw'}/>

So, is there a way to hook up extra directives  to QWeb?

Konstantinos Metaxas
On 10/12/15, 2:00 PM

I'm answering my own question here but the solution is not that hard.

You can take a look at   https://github.com/OCA/server-tools/tree/8.0/qweb_usertime which does exactly that.

Basically override QWeb model like you would any model, and define your own render_tag_<tagname>() method.  

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 10/10/15, 3:23 AM
Seen: 473 times
Last updated: 10/12/15, 2:00 PM