Odoo Help


Can I determine object type in QWeb?

Jeff Beidler
on 1/14/15, 12:21 PM 1,483 views

I customized the "external_layout_header" template from the "report" module in a custom module that modifies the Sales Quote/Order layout.  I didn't realize that this template is also used for Purchase RFQs/Orders.  Now I'm getting errors on the Purchase Order layout, because I moved a field from the sale.order object up into the header template, and this field doesn't exist in the purchase.order object.  Is there any way that I can detect the document/object type with a t-function?  Something along the lines of <t t-if="o = 'sale.order'"> ...?



| 6 5 7
Lodz, Poland

On 1/14/15, 1:31 PM

Try this:

<t t-if="doc_model == 'sale.order'">

Available variables, see: QWeb Reports documentation

Cool. I will try that, thanks! I couldn't find any information on what kinds of comparisons can be done inside of a t-if statement. Is there any documentation for methods and operators?

Jeff Beidler
on 1/14/15, 1:41 PM

Or the available variables, such as the "doc_model" you listed?

Jeff Beidler
on 1/14/15, 1:42 PM

Updated my answer.

on 1/14/15, 2:02 PM

Thanks. I had read the QWeb section, but didn't notice that there was a separate QWeb Reports section.

Jeff Beidler
on 1/14/15, 2:49 PM

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: 1/14/15, 12:21 PM
Seen: 1483 times
Last updated: 3/16/15, 8:10 AM