Skip to Content
Menu
This question has been flagged
2 Replies
17897 Views

I understand that QWeb is a templating language. What I don't understand is where and how to use it. The questions below should demonstrate my confusion.

  • Can I directly use QWeb directives inside of a Form View? That is, can I create a template on the fly inside of a Form View?

  • Can I create a window action that opens up a QWeb View instead of a Form View?

  • How is a QWeb template aware of a model's fields?

Avatar
Discard
Best Answer

I have not seen QWEB directives used inside FORM views, just KANBAN views. (Also Reports and Web Pages).  I don't know of a way to use it outside these three places.

Odoo has a number of examples you can look at to learn how to use it to customize Kanban views within Form Views:  base.view_partner_form (res.partner.form) is a good one.

Qweb knows about models and fields via variables like doc_model

See:

https://www.odoo.com/documentation/11.0/reference/qweb.html

https://www.odoo.com/documentation/11.0/reference/reports.html 

Avatar
Discard
Author

Thanks for your response.

I spent a couple of hours yesterday researching QWeb in the docs, but I didn't find the information you gave above. I didn't look at the reports documentation though.

I may be mistaken, but this information seems to be left out of the documentation. The QWeb documentation page seems to focus exclusively on the directives available in QWeb.

The documentation isn't always enough to help people as the learn to work with Odoo. The system is Open core so looking at the source code, including how Odoo uses QWEB within the default Views and Reports, is a great way to get additional information.

Author

Do you have any tips for deep diving through the source code? Also, are there any good resources that explain the Odoo's architecture in depth? Most documentation I have found is a surface level treatment of the subject.

I find a combination of the following useful to me, but it really depends on your background: (1) the prior documentation platform at https://doc.odoo.com/trunk/server/ is still useful and explains the architecture. (2) there are a series of books you can purchase: https://www.amazon.com/s/ref=nb_sb_noss_2?url=search-alias%3Dstripbooks&field-keywords=odoo (3) many useful videos at https://www.youtube.com/channel/UCkQPikELWZFLgQNHd73jkdg (4) slides from the Odoo Experience at https://www.odoo.com/slides/odoo-experience-2017-12 (5) I suggest learning how to use pdb (python debugger) along the lines of what is outlined at http://www.zbeanztech.com/blog/debugging-openerp

Best Answer

Qweb is a reporting engine or template engine used by odoo. By using this (qweb) we can create reports in odoo. It uses XML to create design of reports as per your need. We can also say that qweb is XML based reporting engine for OpenERP/Odoo.


Avatar
Discard
Related Posts Replies Views Activity
0
Oct 24
117
1
Apr 24
965
7
Sep 24
22444
1
Mar 24
275
0
Feb 24
410