Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Help on adding page-break on qweb reports: where to put the tag?

Odebírat

Get notified when there's activity on this post

This question has been flagged
qwebpagesodoo12.0
1 Odpovědět
35839 Zobrazení
Avatar
Paulo Matos

Hello everyone.

I have the need to add a page-break on core Odoo invoice report report after a specific number of lines. Let's say 10 lines.

I have found several samples and information about which tags to use and how to use "if statements" for adding the page break, but unfortunately any of this samples help me because I do not know where to add the page-break tag.

I have found that the most used tags are:

<p style="page-break-before:always;"> </p> (most reports use this type)
<p style="page-break-after:always"></p>
<div style="page-break-after: auto;"><span style="display: none;"></span>
</div> <p style="page-break-inside: avoid"></p>
<div style="page-break-inside: auto"></div>

Also found that one can use "if statements" inside the "for each" loops with the help of counter variables. For instance:

<t t-foreach="o.line_ids" t-as="line">
    <t t-if="line_index == 13">
        <div style="page-break-after: always;"><br/></div>
    </t>
</t>

Ok. Everything seems to be very easy, but all tests I have made were unsuccessful.

The core Odoo invoice report already have the "<t t-foreach...":

The core report (part of it):

<t t-foreach="o.invoice_line_ids" t-as="line">
    <t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
    <t t-set="current_subtotal" t-value="current_subtotal + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
    <tr t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''">
    <t t-if="not line.display_type" name="account_invoice_line_accountable">
        <td name="account_invoice_line_name"><span t-field="line.name"/></td>
        <td class="d-none"><span t-field="line.origin"/></td>
        <td class="text-right">
            <span t-field="line.quantity"/>
            <span t-field="line.uom_id" groups="uom.group_uom"/>
        </td>
        <td t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
            <span t-field="line.price_unit"/>
        </td>
        ...more code here
</t> #End of for loop here

On my understanding, Qweb starts the loop and for every line (record) it finds, it will add the <tr's> and <td's> based on table structure.

So, based on that, I have tried to use qweb variables and an if statement to increase a counter, and if the 10th value is reached, qweb adds a page break.

So I have tried:


<t t-set="counter" t-value="0" />

<t t-foreach="o.invoice_line_ids" t-as="line">

    <t t-if="counter == 10">
        <p style="page-break-before:always;"> </p>
    </t>
    <t t-set="counter" t-value="counter + 1" />
    
....here starts the core Odoo report data
    <t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
    <t t-set="current_subtotal" t-value="current_subtotal + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
    <tr t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''">
    <t t-if="not line.display_type" name="account_invoice_line_accountable">
        <td name="account_invoice_line_name"><span t-field="line.name"/></td>
        <td class="d-none"><span t-field="line.origin"/></td>
        <td class="text-right">
            <span t-field="line.quantity"/>
            <span t-field="line.uom_id" groups="uom.group_uom"/>
        </td>
        <td t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
            <span t-field="line.price_unit"/>
        </td>
        ...more code here
</t> #End of for loop here

Using this approach it does not work and it adds a page break at the first page and the full report content (table header, rows and columns) goes to the second page.

Also tried to add the full code starting from the "foreach" inside the if condition and using this approach, I can only see the table header and cannot see the rows and columns...

Can anyone please send me a sample on where should I put this if condition in order to get the desired result? Break the page after the 10th invoice line?

Thank you all very much in advance

Best regards

PM


1
Avatar
Zrušit
Jornald

I have same problem.How did you solve this?

Simon in Canada

Any luck in finding a solution for this?

Avatar
Régis GEROMEGNACE
Nejlepší odpověď

Hello,

You must reinitialize your counter I think like this or use modulo if possible in qweb.

 

<t t-if="counter == 10">
<p style="page-break-before:always;"> </p>

<t t-set="counter" t-value="0"/>
</t>

<t t-set="counter" t-value="counter + 1" />

Regards,

4
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Replace the print option on top of form with a Print button. How can I achieve that? Vyřešeno
qweb reporting odoo12.0
Avatar
Avatar
1
úno 19
10588
Print payslip is not generating all pages - Working randomly
qweb payroll payslip odoo12.0
Avatar
0
kvě 19
2863
Expected singleton: hr.emp.travel.location(62, 63)
odoo12.0
Avatar
Avatar
Avatar
2
říj 25
2110
Odoo 18: Display image from char field containing url in qweb form
qweb
Avatar
Avatar
1
čvc 25
3120
PDF Export Option for QWeb Reports in odoo 17.0
qweb
Avatar
Avatar
1
kvě 25
4096
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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