İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

how to properly change header and footer in external pdf report template

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
1 Cevapla
8763 Görünümler
Avatar
Liechti Jean-Christophe

Hello, 

I'm very new to Odoo. I'm just trying to adapt the header and the footer of the external_layout_standard to fit my needs. 


I have created a custom module with a new paper_format.xml and a header_footer.xml overriding the default header and footer from web.external_layout_standard by using XPATH replace. 


So far I can load the module. When I do a modification, I restart the server, "update app list", upgrade my module and try to see the change by printing a "Quotation/Order" again. 


What is strange and drives me nuts is that I have the feeling the template is not always loaded the same... For example, sometimes the company address is displayed, sometimes not, suddenly a page is printed twice... 


I can't understand what I'm doing wrong. 


Can anybody recommend me a good tutorial on how to design PDF template and to understand the logic on how a page is built? 


Thank you in advance! 

JC


0
Avatar
Vazgeç
Divyansh Tripathi

share the code snippet please

Liechti Jean-Christophe
Üretici

This is the __manifest__.py:

# -*- coding: utf-8 -*-

{

'name': 'DD module',

'version': '1.0',

'summary': 'Mainly a header and footer for print report',

'description': '',

'category': 'Productivity',

'author': 'JCL',

'website': '',

'license': '',

'depends': ['web', 'base'],

'data': [

'reports/header_footer.xml',

'reports/paper_format.xml',

],

'demo': [''],

'installable': True,

'application': True,

'auto_install': False,

}

And this is the header_footer.xml:

<?xml version="1.0" encoding="utf-8"?>

<odoo>

<template id="external_layout_standard_DD" inherit_id="web.external_layout_standard">

<!-- Custom Header for DD -->

<xpath expr="//div[1]" position="replace">

<div t-attf-class="header o_company_#{company.id}_layout" t-att-style="report_header_style">

<div class="row">

<div class="col-4 mb4">

<img t-if="company.logo" t-att-src="image_data_uri(company.logo)" style="max-height: 45px;" alt="Logo"/>

</div>

</div>

<div class="row">

<div class="col-4 mb4" name="company_address">

<div t-field="company.partner_id"

t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}' style="font-size:6px"

/>

</div>

</div>

</div>

<div t-attf-class="article o_report_layout_standard o_company_#{company.id}_layout" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id" t-att-data-oe-lang="o and o.env.context.get('lang')">

<div class="pt-5">

<!-- This div ensures that the address is not cropped by the header. -->

<t t-call="web.address_layout"/>

</div>

<t t-raw="0"/>

</div>

</xpath>

<!-- Custom Footer for DD -->

<!-- Custom footer -->

<xpath expr="//div/div[hasclass('text-center')]" position="replace">

<div class="text-center" style="border-top: 1px solid black;">

<ul class="list-inline mb4 text-nowrap">

<li t-if="company.phone" class="list-inline-item d-inline">Phone: <span class="o_force_ltr" t-field="company.phone"/></li>

<li t-if="company.email" class="list-inline-item d-inline">Email: <span t-field="company.email"/></li>

<li t-if="company.website" class="list-inline-item d-inline">Web: <span t-field="company.website"/></li>

<li t-if="company.vat" class="list-inline-item d-inline"><t t-esc="company.country_id.vat_label or 'Tax ID'"/>: <span t-field="company.vat"/></li>

</ul>

</div>

</xpath>

</template>

</odoo>

Avatar
Cybrosys Techno Solutions Pvt.Ltd
En İyi Yanıt

Hi,

you can try this code in your XML file:


<template id="custom_purchase_header_footer"               inherit_id="web.external_layout_striped">

<xpath expr="//div[1]" position="replace">

   <div t-attf-class="o_company_#{company.id}_layout header" t-att-style="report_header_style">

     <div class="o_background_header" style="position:absolute;">

       <div class="float-right">

            <h3 class="mt0 text-right" t-field="company.report_header"/>

       </div>

        <div class="header_content float-right">

            <div class="logo" style="">

          <img t-if="company.logo" style="max-width:260px;max-height:89px;"

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

                      class="float-left" alt="Logo"/>

           </div>

          </div>

             <div class="float-left">

               <div class="details">

                 <table class="table_partner" style="width:120%;">

                   <tr>

                   <td><b style="color:black;"> CLIENT Details:</b></td>

                   </tr>

                   <tr>

                     <td>

                       <b>

                           <span style="color:black;" t-if="company"

                              t-esc="o.partner_id.name"/>

                       </b>

                         <br></br>

                       <t t-if="o.partner_id.street">

                           <span  t-esc="o.partner_id.street"/>

                           <br></br></t>

                       <t t-if="o.partner_id">

                           <span t-esc="o.partner_id.city"/>

                           <br></br>

                       </t>

                      </td>

                   </tr>

                 </table>

               </div>

             </div>

     </div>

     </div>

</xpath>

<xpath expr="//div[hasclass('text-center')]" position="replace">

 <center>

     <h5 style="color:black;"><b><t t-esc="o.company_id.name"/></b></h5>

     <h6 style="color:black;">Your company details</h6>

     Page: <span class="page"/> / <span class="topage"/>

 </center>

</xpath>

 </template>


Hope it helps

0
Avatar
Vazgeç
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Üye Ol
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now