This question has been flagged
2 Replies
4505 Views

Hello all,

In this payslip, how to display only the last amount of 751,83 $ in the section « Salaire net : »????

Here is my template code for this section :

                        <div class="col-xs-4" style="">
                            <h4>
                                <strong>Net pay :</strong>
                            </h4>
                            <div style="margin-left: 20px;">
                                <div t-foreach="get_payslip_lines(o.line_ids)" t-as="p">
                                    <span t-esc="formatLang(p.amount, currency_obj=o.company_id.currency_id)" />
                                    <span t-esc="formatLang(p.total, currency_obj=o.company_id.currency_id)" />
                                </div>
                            </div>
                            <br />
                        </div>

 

What do you think about that? Idea?

 

 

 

 

 

 

 

Avatar
Discard
Best Answer

Try print only the last line:

<div t-foreach="get_payslip_lines(o.line_ids)" t-as="p">
<t t-if="p_index + 1 == len(get_payslip_lines(o.line_ids))">
    <span t-esc="formatLang(p.amount, currency_obj=o.company_id.currency_id)" />
    <span t-esc="formatLang(p.total, currency_obj=o.company_id.currency_id)" />
</t>
</div>

or identify line by p.salary_rule_id.code = 'NET'

Avatar
Discard
Author

Thanks a lot! I'm happy. You had two typos. They are corrected.

Author Best Answer

great!

Avatar
Discard