Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
174 Widoki

 my report layout should be apply for first page only(not the report content file) my problem is , if this report extend for two pages, this report layout is apply to this second page too, but it shouldn't be, i need to remain this laout in this first page only,specially header part  ,  what Can i do? i am using CSS


Awatar
Odrzuć
Autor Najlepsza odpowiedź

But i am using my own layout(custom one), Howcan i apply it to this one?

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="account_commercial_custom_layout">

<div class="header" style="margin-bottom:50px; page-break-inside: avoid;">
<div class="row" style="display: flex; width:100%;">

<table class="table" style="width: 100%; margin-bottom:5px; border-bottom:none;">
<!-- Row 1: Totals -->
<tr>
<td style="width: 30%; text-align: right;">
<div style="text-align:left;">
<img src="\vkd_invoice_report\static\logo.jpg"
style="max-height: 100px; margin-bottom:5px"
alt="Company Logo"/>
</div>
<div style="font-size: 14px; line-height: 1; text-align:left;">
<strong>REGISTERED ADDRESS:</strong>
<div t-field="o.company_id.partner_id"
t-options='{"widget":"contact","fields":["address","name"],"no-maker":True }'/>
</div>
</td>
<td style="width: 40%;">
<div style="font-size: 14px; line-height: 1; text-align:right; margin-top: 50px;">

<strong t-field="o.company_id.name"/>
<br/>
<span t-field="o.company_id.street"/>
<br/>
<span t-if="o.company_id.street2" t-field="o.company_id.street2"/>
<br/>
<span t-field="o.company_id.city"/>
<span t-if="o.company_id.state_id">,
<span t-field="o.company_id.state_id.name"/>
</span>
<span t-field="o.company_id.zip"/>
<br/>
<span t-if="o.company_id.country_id" t-field="o.company_id.country_id.name"/>
</div>
</td>
<td style="width: 30%; text-align: right;">
<div style="font-size:18px; font-weight:bold; color: #d9534f; text-transform: uppercase; text-align:center; margin-top: 80px">
COMMERCIAL INVOICE
</div>
</td>
</tr>

</table>
</div>
</div>
<div class="article" style="position:relative;">
<!-- Watermark -->
<div t-if="report_type == 'pdf'"
style="position: fixed; top: 30px; left: 0; width: 100%; -webkit-transform: rotate(-30deg); transform:rotate(-30deg); text-align: center; z-index: 0; opacity: 0.15; pointer-events: none;">
<span style="font-size:9em; color:#FF7F50; font-weight:bold; display:inline-block;">
Invoice
</span>
</div>
<t t-raw="0"/>
</div>
<!--footer section-->
<div style="margin-bottom:5px;" class="footer">
<hr style="border:none; border-top: 3px solid #000; margin: 5px 0;"/>
<div style="width:100%; font-size: 20px; margin-bottom:5px;">
<div t-if="report_type == 'pdf'" class="text-muted">
Page:
<span class="page"/>
of
<span class="topage"/>
<span style="float:right; font-size:20px">
<strong>Printed:</strong>
<t t-esc="datetime.datetime.now().strftime('%Y-%m-%d')"/>
</span>
</div>
</div>
</div>
<!--footer section-->
</template>
</odoo>
Awatar
Odrzuć

Sure, Install the module first, and then add the template and upgrade the module.

Try the code.

<div class="header first-page" style="margin-bottom:50px; page-break-inside: avoid;">
<div class="row" style="display: flex; width:100%;">

<table class="table" style="width: 100%; margin-bottom:5px; border-bottom:none;">
<tr>
<td style="width: 30%; text-align: right;">
<div style="text-align:left;">
<img src="\vkd_invoice_report\static\logo.jpg"
style="max-height: 100px; margin-bottom:5px"
alt="Company Logo"/>
</div>
<div style="font-size: 14px; line-height: 1; text-align:left;">
<strong>REGISTERED ADDRESS:</strong>
<div t-field="o.company_id.partner_id"
t-options='{"widget":"contact","fields":["address","name"],"no-maker":True }'/>
</div>
</td>
<td style="width: 40%;">
<div style="font-size: 14px; line-height: 1; text-align:right; margin-top: 50px;">
<strong t-field="o.company_id.name"/>
<br/>
<span t-field="o.company_id.street"/>
<br/>
<span t-if="o.company_id.street2" t-field="o.company_id.street2"/>
<br/>
<span t-field="o.company_id.city"/>
<span t-if="o.company_id.state_id">,
<span t-field="o.company_id.state_id.name"/>
</span>
<span t-field="o.company_id.zip"/>
<br/>
<span t-if="o.company_id.country_id" t-field="o.company_id.country_id.name"/>
</div>
</td>
<td style="width: 30%; text-align: right;">
<div style="font-size:18px; font-weight:bold; color: #d9534f; text-transform: uppercase; text-align:center; margin-top: 80px">
COMMERCIAL INVOICE
</div>
</td>
</tr>
</table>
</div>
</div>

Najlepsza odpowiedź

Hi,


To print the header/footer only on the first/last page, you can use the OCA module.


* https://odoo-community.org/shop/report-qweb-element-page-visibility-2192


After installing the module, use the first-page or last-page class.


Header


<div class="header">

    <div class="first-page">

        <div class="row">

            <img t-if="company.custom_report_header"

                 t-att-src="image_data_uri(company.custom_report_header)"

                 alt="Logo" width="100%"/>

        </div>

    </div>

</div>



Footer.


<div class="footer o_standard_footer">

    <div class="last-page">

        <div style="width: 100%;">

             <img t-if="company.custom_report_footer"

             t-att-src="image_data_uri(company.custom_report_footer)"

             alt="Logo" width="100%"/>

          </div>


      </div

</div>



Hope it helps

Awatar
Odrzuć
Autor

I think this is deprecicated module, there are many more errors, Ared there another solutions?

Powiązane posty Odpowiedzi Widoki Czynność
1
sie 25
461
0
lip 25
599
0
lip 25
1201
1
maj 25
1695
1
kwi 25
1768