Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

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

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
qweb template viewqweb-reportqweb-csscss-styleodoo10
1 Svar
8192 Visninger
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
Kassér
Avatar
Dasadiya Chaitanya
Forfatter Bedste svar


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
Kassér
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

Enjoying the discussion? Don't just read, join in!

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

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
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
5562
How to rescale Images on a report(pdf)? Løst
v8 report qweb template view qweb-report qweb-css
Avatar
Avatar
Avatar
4
nov. 19
14086
How to create a report with custom data and use that data in QWEB report?
qweb-report odoo10
Avatar
Avatar
4
mar. 20
18404
Get id from model in qweb report
qweb-report odoo10
Avatar
Avatar
3
maj 18
7947
How to save a qweb report to a binary field Løst
binaryfield qweb-report odoo10
Avatar
Avatar
3
apr. 22
17853
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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