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

I try to inherit web.external_layout to remove header and footer because I want to custom my report pdf. I try to remove t-call="web.external_layout"​ , the header and footer is gone but the page become a mess. Every page was merge into a page even in different page class. So I think I should modify the web.external_layout

Here's my attempt to do it


But I got error Element '' cannot be located in parent view​ . I tried different approach like below

- change the expression to "//div[class='header']".  got same error but with this element

- change the expression to "//div[t-attf-class='header']".  got same error but with this element


Then I think it's because header was inherited from external_layout_standard​. So I change the inherit_id to web.external_layout_standard​ and try the same way as above. But still got the same error


How can I remove the header and footer?

아바타
취소
작성자

@Cybrosys I'm making a new custom report pdf for new custom module. If I comment `external_layout`, the page will be merge to one page even I put "page" class in the div tag

External id web.basic_layout is working. thanks for the suggestion

베스트 답변

Could you please try with basic layout.


아바타
취소
작성자

I tested it. when I want to have a multiple page on a single record, it's merging into one page. I want it to keep seperate

```

<t t-foreach="docs" t-as="o">
<t t-call="web.basic_layout">
<div class="page" style="background-color: #2eb9ff !important;">
<div class="oe_structure"/>
<h2>Report</h2>
<p>
<span t-field="o.label"/>
</p>
</div>
<div class="page" style="background-color: #2eb9ff !important;">
<div class="oe_structure"/>
<h2>Report</h2>
<p>
<span t-field="o.label"/>
</p>
</div>
</t>
</t>
```

You can use page break.

<t t-foreach="docs" t-as="o">
<t t-call="web.basic_layout">
<div class="page" style="background-color: #2eb9ff !important;">
<div class="oe_structure"/>
<h2>Report</h2>
<p>
<span t-field="o.label"/>
</p>
</div>
<p style="page-break-after:always;"/>
</t>
</t>

작성자 베스트 답변

I Found the solution. If you print the report as HTML, you can get the class of the element. Just copy the element (with all the attribute and remove anything that's not necessary)

You can completely remove the header and the footer. Then the seperate page is still working.

I think the style for seperate page is in the article

If you want to use this code, make notes that i'm using odoo 16. I recommend you to check the element from printing the report as HTML


This is for the header


This is the content


This is the footer


아바타
취소
관련 게시물 답글 화면 활동
PDF reports 해결 완료
5
7월 25
2374
Wrong PDF Format 해결 완료
2
3월 24
2918
2
7월 23
2608
0
11월 22
3067
2
2월 19
4254