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
    • Social 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
    • Guest House
    • Drankenhandelaar
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Solar Energy Systems
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC Services
    Others
    • Nonprofit Organization
    • 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

Page Break Issue On Custom Cheque Page in Odoo 10 Qweb PDF Report

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
qweb template viewqweb-reportqweb-csscss-styleodoo10
1 Beantwoorden
8210 Weergaven
Avatar
Dasadiya Chaitanya

I have faced some of the issue page break in Qweb report in last few days. I am trying to print my Qweb report for Cheque format and single Qweb page divided into 3 different sections 

Section 1 : Displaying invoice list details
Section 2 : Bank details and amount which we will pay to our owner/tenant in MICR FONT 13B FONT
Section 3 : Displaying invoice list details

section 1 & 3 are the common and displaying the same invoices details into both of the sections and about the section2 will change as per the different amount which we will pay to owner/tenant.

Expected Result :

I have 23 invoice details are attached it into single cheque then I want to bifurcate my invoice details into different slot

sloat 1 : Display first 10 invoice details into first page
sloat 2 : Display next 10 invoice details into second page
sloat 3 : Display remaning 3 invoice details into third page

I want to bifurcate my invoice details into different sloat wise page if the total number of invoices are more than 10 lines

What I have tried from my side ?

Attempt 1 : Using counter variable and update the counter through iterating the loop and break it when 10 is reach divide by 0 Applied this code inside into loping

<t t-set="count" t-value="count+1" />
    <t t-if="count%10== 0">
         <div style="page-break-after:auto;"/> 
    </t>
</t>

Attempt 2:

<span t-esc="line_index+1"/> 
<t t-if="line_index+1%10 ==0"> 
    <div style="page-break-inside:auto !important;"> 
</t>

1
Avatar
Annuleer
Avatar
Dasadiya Chaitanya
Auteur Beste antwoord


I have also fixed the issue from my end after tried a lot more attempts

If any one will face the same issue in your future development so that they can also able to fix it quickly.

Create a method into specific model  : (cheque.cheque model) 

def get_invoice_details(self, invoice_ids,cheque):
    vals,container,result,val=[],[],[],1
    invoice_no=''
    for line in invoice_ids:
        desc=''
        if line.is_vendor:
            invoice_no=line.vendor_reference
        else:
            invoice_no=line.number

        pay_amt=line.payment_ids.filtered(lambda m: m.cheque_issued_id.id ==cheque.id).amount or 0.00
        for l in line.invoice_line_ids:
            desc+=str(l.product_id.default_code)+',' or ''
        vals.append({
            'date':str(line.date_invoice),
            'invoice_no':invoice_no,
            'inv_amt':str(line.amount_total),
            'description':desc,
            'pay_amt':float(pay_amt)
        })
        invoice_no=''
    for l in vals:
        if val<=len(vals):
            container.append(l)
        if val % 9 == 0:
            result.append({'section':9,'vals':container})
            container=[]
        val+=1
    if container:
        result.append({'section':4,'vals':container})
    return result

In this method I have set section key with its value into result of list for dictionary where we are using the same section to making the page break perfectly

Call the same method and iterate it into Qweb Template
<t t-foreach="o.get_invoice_details(o.invoice_ids,o)" t-as="line" >
                <div class="page">
                    <div class="col-xs-12">
                                <table style="width:100%">
                                    <thead>
                                        <tr>
                                            <th>Invoice Date</th>
                                            <th>Invoice # </th>
                                            <th>Invoice Amt</th>
                                            <th>Description  </th>
                                            <th style="text-align:right">Payment Amt</th>
                                        </tr>
                                    </thead>
                                    <t t-foreach="line.get('vals')" t-as="inv">
                                    <tbody class="sale_tbody">
                                        <tr>
                                            <td>
                                                <span t-esc="inv.get('date')" />
                                            </td>
                                            <td>                                                
                                                <span t-esc="inv.get('invoice_no')" />
                                            </td>
                                            <td>
                                                <span t-esc="o.decimal_formated_amount(float(inv.get('inv_amt',0.00)))" />
                                            </td>

                                            <td>
                                                <span t-esc="inv.get('description')" />
                                            </td>
                                            <td style="text-align:right">
                                                <span t-esc="o.decimal_formated_amount2(float(inv.get('pay_amt',0.00)))" />                                             

                                       </td>
                                        </tr>               
                                    </tbody>
                                    </t>
                                </table>
                        </div>
                      <span t-if="line.get('section') % 9 == 0" style="page-break-after: always;">
                      </span>
                </div>

As per the business logic of get_invoice_details() method which is return the data in list form and then we can user the same and render it into the XML template.

Odoo will manage the page break automatically when the condition will satisfy over the XML template system will automatically bifurcate the page according to source code.

I hope my answer may helpful for you :)






















































2
Avatar
Annuleer
Paulo Matos

Great @Dasadiya Chaitanya,

Can you please post a sample method for use with account..invoice model for invoice report?

I also need a way to correctly generate a page break after a specific number of invoice lines and I am unable to do it on Odoo 12.

Thank you very much

Best regards

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
How to insert Customer Preview button and edit the html report in custom module same as sale module in Odoo-14
qweb preview qweb template view qweb-report qweb-css
Avatar
Avatar
1
dec. 21
5584
How to rescale Images on a report(pdf)? Opgelost
v8 report qweb template view qweb-report qweb-css
Avatar
Avatar
Avatar
4
nov. 19
14112
How to create a report with custom data and use that data in QWEB report?
qweb-report odoo10
Avatar
Avatar
4
mrt. 20
18430
Get id from model in qweb report
qweb-report odoo10
Avatar
Avatar
3
mei 18
7970
How to save a qweb report to a binary field Opgelost
binaryfield qweb-report odoo10
Avatar
Avatar
3
apr. 22
17871
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