Odoo Help


This community 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.


Can I determine object type in QWeb?

Jeff Beidler
on 1/14/15, 12:21 PM 836 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'"> ...?



| 5 4 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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 1/14/15, 12:21 PM
Seen: 836 times
Last updated: 3/16/15, 8:10 AM