콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
8348 화면

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'"> ...?

아바타
취소
베스트 답변

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?

작성자

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

Updated my answer.

작성자

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

Thank you very much for the answer. I spent so many hours fixing my problem before find this forum.

My code was:
<div t-if="o._name == 'sale.order'">

So I obtained odoo error:
AttributeError: 'NoneType' object has no attribute '_name'

you change the code like this. it will work
<div>
<t- t-if="o._name == 'sale.order'">
</t>
</div>

관련 게시물 답글 화면 활동
1
7월 16
24418
2
3월 15
7577
1
6월 21
8051
0
3월 15
3761
1
3월 15
14174