Skip to Content
Menu
This question has been flagged
1 Reply
1237 Views

I want to break if line is 6 row.I used page break but it is not worked.My code is below.

<div class="wht_certs">
            <t t-set='count' t-value='0'/>
            <t t-foreach="wht_certs" t-as="cert">
              <t t-set='count' t-value='count+1'/>
              <div class="wht_line">
                <div class="row">
                    <p class="box-vat"><t t-esc="cert.supplier_taxid[:1]"/></p>
                    <p class="box-vat vat_tab"><t t-esc="cert.supplier_taxid[1:2]"/></p>
                    <p class="box-vat"><t t-esc="cert.supplier_taxid[2:3]"/></p>
                    <p class="box-vat"><t t-esc="cert.supplier_taxid[3:4]"/></p>
                    <p class="box-vat"><t t-esc="cert.supplier_taxid[4:5]"/></p>
                    <p class="box-vat vat_tab2"><t t-esc="cert.supplier_taxid[5:6]"/></p>
                    <p class="box-vat"><t t-esc="cert.supplier_taxid[6:7]"/></p>
                    <p class="box-vat"><t t-esc="cert.supplier_taxid[7:8]"/></p>
                    <p class="box-vat"><t t-esc="cert.supplier_taxid[8:9]"/></p>
                    <p class="box-vat"><t t-esc="cert.supplier_taxid[9:10]"/></p>
                    <p class="box-vat vat_tab2"><t t-esc="cert.supplier_taxid[10:11]"/></p>
                    <p class="box-vat"><t t-esc="cert.supplier_taxid[11:12]"/></p>
                    <p class="box-vat vat_tab"><t t-esc="cert.supplier_taxid[12:13]"/></p>
                    <div class="company_branch_sum_line">
                        <t t-if="cert.supplier_partner_id.branch">
                          <div class="row">
                            <p class="box-branch-sum"><t t-esc="cert.supplier_partner_id.branch[:1]"/></p>
                            <p class="box-branch-sum"><t t-esc="cert.supplier_partner_id.branch[1:2]"/></p>
                            <p class="box-branch-sum"><t t-esc="cert.supplier_partner_id.branch[2:3]"/></p>
                            <p class="box-branch-sum"><t t-esc="cert.supplier_partner_id.branch[3:4]"/></p>
                            <p class="box-branch-sum"><t t-esc="cert.supplier_partner_id.branch[4:5]"/></p>
                          </div>
                        </t>
                    </div>
                </div>
                <div class="partner_name">
                    <t t-if="cert.supplier_partner_id.name">
                      <div class="row">
                        <p><t t-esc="cert.supplier_partner_id.name"/></p>
                      </div>
                    </t>
                </div>
                <div class="partner_address">
                    <div class="row">
                      <p><t t-esc="cert.supplier_partner_id.street"/> <t t-esc="cert.supplier_partner_id.street2"/> <t t-esc="cert.supplier_partner_id.city"/> <t t-esc="cert.supplier_partner_id.state_id.name"/> <t t-esc="cert.supplier_partner_id.zip"/></p>
                    </div>
                </div>
                <div class="line_date_col">
                  <t t-foreach="cert.wt_line" t-as="line">
                    <span class="date_value" t-esc="cert.date"/>
                    <span class="desc_value" t-esc="line.wt_cert_income_desc[:20]"/>
                    <span class="percent_value" t-esc="'{0:,.2f}'.format(line.wt_percent)"/>
                    <span class="base_value" t-esc="'{0:,.2f}'.format(line.base)"/>
                    <span class="amount_value" t-esc="'{0:,.2f}'.format(line.amount)"/>
                    <br/>
                  </t>
                </div>
              </div>
              <t t-if='count%6==0'>
                <p style="page-break-before:always;">
              </t>
            </t>
          </div

Avatar
Discard
Best Answer

replace this <p style="page-break-before:always;"> with <p style="page-break-before:always;"/>

Avatar
Discard
Author

I forgot /. But I tried but not work. Can I make page break from my code?

Here is my generate report.I found we can make page break using code.

@api.model

def _get_report_values(self, docids, data=None):

report = self.env['ir.actions.report']._get_report_from_name(

'sc_thai_wht_pnd53_report.pnd53_summary')

date_from = data['form']['date_from']

date_to = data['form']['date_to']

partner_id = data['form']['partner_id']

original_copy = data['form']['original_copy']

copy_count = data['form']['copy_count']

month_from = data['form']['month_from']

with_attachments = data['form']['with_attachments']

if partner_id:

domain = [('supplier_partner_id','=',partner_id),('date','>=',date_from),('date','<=',date_to),('income_tax_form','=','pnd53'),('state','=','done')]

else:

domain = [('date','>=',date_from),('date','<=',date_to),('income_tax_form','=','pnd53'),('state','=','done')]

wht_certs = self.env['withholding.tax.cert'].search(domain)

pages_count = int(len(wht_certs)/6) + 1 if len(wht_certs) % 6 > 0 else int(len(wht_certs)/6)

return {

'doc_ids': docids,

'pages_count': pages_count,

'pages': range(pages_count),

'wht_certs': wht_certs,

'doc_model': report.model,

'docs': self.env.user.company_id,

'report_type': data.get('report_type') if data else '',

'company': self.env.user.company_id,

}

Related Posts Replies Views Activity
2
Jul 23
3235
1
Jun 23
2593
1
Apr 23
3187
1
Nov 22
2120
1
Oct 21
10825