Help

how to Print sale order report with 10 lines per pages

Closed
Avatar
Sugeesh Ps

The question has been closed for reason: Question / Code not indented

by
Sugeesh Ps
on 03/17/2020 05:30:11

Print Sale Order Report with 10 Orderlines per page.

When I add a page break after 10 lines, the page break appears before the oederlines.

Hesre is my code:

<! - Lines associated ->


                            <t t-foreach = "layout_category ['lines']" t-as = "l">

                                <Tr>

                                    <td> <span t-field = "l.name" /> </ td>

                                    <td class = "text-right">

                                        <span t-field = "l.product_uom_qty" />

                                        <span t-field = "l.product_uom" groups = "product.group_uom" />

                                    </ Td>

                                    <td class = "text-right">

                                        <span t-field = "l.price_unit" />

                                    </ Td>

                                    <td t-if = "display_discount" class = "text-right" groups = "sale.group_discount_per_so_line">

                                        <span t-field = "l.discount" />

                                    </ Td>

                                    <td class = "text-right">

                                        <span t-esc = "',' .join (map (lambda x: (x.description or x.name), l.tax_id))" />

                                    </ Td>

                                    <td class = "text-right" groups = "sale.group_show_price_subtotal">

                                        <span t-field = "l.price_subtotal"

                                            t-options = '{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}' />

                                    </ Td>

                                    <td class = "text-right" groups = "sale.group_show_price_total">

                                        <span t-field = "l.price_total"

                                            t-options = '{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}' />

                                    </ Td>

                                </ Tr>



                                <div t-if = "l_index> 9" style = "page-break-after: always;">

                                     <br/>

                                </ Div>

                            </ T>



Please help me to solve this, 

Thanks in advance....

Avatar
Discard
4 Answers
5
Avatar
Dipak Shah
Best Answer
Hello @Sugeesh Ps,

Technically what you can do :
1) use counter variable , first of all set is as 0 (e.g <t t-set="count" t-value="0" />)
     > Then do +1 in it in your order iine for loop. (e.g <t t-set="count" t-value="count + 1" />)


2) Secondly check before printing each line whether counter > 10 or not. if counter > 10 then do page break here itself in t-if condition.


 > For page break use code like :- (<p style="page-break-after:always"></p>)
 > For Checking if condition use :- <t t-if="count > 10"> your page break code </t>

Hope this will help you !

 

1 Comment
Avatar
Discard
Avatar
Sugeesh Ps
-

@Dipak Shah,

Thank you so much for your answer. I have tried this several times and what i obtained is that the page break is appearing only before the order line table insted of appearing after 10 lines.