Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
9689 Lượt xem

Hi,

I'm trying to setup, that the header (our company logo) will only be displayed on the first page.

I have researched a lot and just founded solutions for older versions (v10 & lower) or I just wasn't able to set it up.

It's regarding Odoo V12.


Update: 

After changing the code, the Header & Footer are completely gone on all pages. Just in the preview it will be displayed, but not if I download the PDF. 
I have already re-installed the Wkhtmltopdf 0.12.5–1 extension & also checked the report url inside the system parameters (this is already set to http://127.0.0.1:8069) - no success.


Our template which we are using (UPDATED @27 December)

<?xml version="1.0"?>

<t t-name="l10n_de.external_layout_din5008">
<t t-if="not o and doc">
<t t-set="o" t-value="doc"/>
</t>
<t t-if="o and 'company_id' in o">
<t t-set="company" t-value="o.company_id.sudo()"/>
</t>
<t t-if="not o or not 'company_id' in o">
<t t-set="company" t-value="res_company"/>
</t>
<div>
<t t-call="web.basic_layout">
<t t-set="o" t-value="o.with_context(lang=o.partner_id.lang)"/>
<div class="page">
<div class="header">
<img t-if="company.logo" t-att-src="image_data_uri(company.logo)" class="float-left" style="margin-left:95px !important; max-height:75px !important;"/>
</div>
</div>
</t>
<div class="article din" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id"> <t t-raw="0"/>
</div>
<div class="footer o_background_footer din" style="position:absolute !important; left:0mm !important; right:0mm !important; width:100% !important; height:542mm !important; background-color:#0870b0 !important; bottom:auto !important;">
<div style="height:20px !important; width:100%;">
</div>
<div style="color:white; margin-left:95px; width:auto; height:auto; font-family:Arial !important; font-size:0.8em !important; float:left !important;">
just some text here
</div>
<div style="color:white; margin-left:65px; width:auto; height:auto; font-family:Arial !important; font-size:0.8em !important; float:left !important;">
just some tex there
</div>
<div style="color:white; margin-left:65px; width:auto; height:auto; font-family:Arial !important; font-size:0.8em !important; float:left !important;">
just some text here
Seite <span class="page"/>/<span class="topage"/>
</div>
</div>
</div>
</t>



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

use basic layout on your report and put your header inside the page class so the header will be only on the first page


<template id="report_sale_order_custom_document">
<t t-call="web.basic_layout"> 
 <t t-set="o" t-value="o.with_context(lang=o.partner_id.lang)"/>​
<div class="page">
//put your header code here
</div>
 </t>
</template>
Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Hi @alvinadjie, thanks for the tip.

Can you please explain this in detail?

I have tried to merge this into our Report, which is called external_layout_din5008 and the external ID is  l10n_de.external_layout_din5008.

My Code looks now like this, but now the logo / header and also the footer is on all pages invisible.

And really strange is, that on the preview the logo / header & footer will be there, but when I'm download / print the invoice, header / logo & also the footer are gone?!

I have updated my originally code above.


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 23
11242
2
thg 5 24
7676
2
thg 2 21
4936
1
thg 6 25
25037
3
thg 4 23
6955