Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
6093 Visualizzazioni

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?

Avatar
Abbandona
Autore

@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

Risposta migliore

Could you please try with basic layout.


Avatar
Abbandona
Autore

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>

Autore Risposta migliore

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


Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
5
lug 25
2161
2
mar 24
2697
2
lug 23
2496
0
nov 22
2902
2
feb 19
4051