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
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
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>
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>
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
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 8 25
|
416 | ||
|
0
thg 7 25
|
585 | ||
|
0
thg 7 25
|
1193 | ||
|
1
thg 5 25
|
1690 | ||
|
1
thg 4 25
|
1750 |