Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

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

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
qwebpagesodoo12.0
1 Beantwoorden
35826 Weergaven
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
Annuleer
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
Beste antwoord

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
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Replace the print option on top of form with a Print button. How can I achieve that? Opgelost
qweb reporting odoo12.0
Avatar
Avatar
1
feb. 19
10587
Print payslip is not generating all pages - Working randomly
qweb payroll payslip odoo12.0
Avatar
0
mei 19
2857
Expected singleton: hr.emp.travel.location(62, 63)
odoo12.0
Avatar
Avatar
Avatar
2
okt. 25
2100
Odoo 18: Display image from char field containing url in qweb form
qweb
Avatar
Avatar
1
jul. 25
3118
PDF Export Option for QWeb Reports in odoo 17.0
qweb
Avatar
Avatar
1
mei 25
4090
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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