Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
5382 มุมมอง

Hello my friends! 

In the contribution register qweb template, we would want to write the payslip number (from hr.payslip) for each line.

sd

Our PDF report is like this : (see ######)

We have this code in the file report_contributionregister.xml :

                    <table class="table table-condensed">
                        <thead>
                            <tr>
                                <th>Number</th>
                                <th>PaySlip name</th>
                                <th>Code</th>
                                <th>Name</th>
                                <th>Quantity</th>
                                <th>Amount</th>
                                <th>Total</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr t-foreach="get_payslip_lines(o)" t-as="r">
                                <td>
                                    <span>######</span>
                                    <span t-esc="r.get('number')"/>

                                </td>
                                <td><span t-esc="r.get('payslip_name')"/></td>
                                <td><span t-esc="r['code']"/></td>
                                <td><span t-esc="r['name']"/></td>
                                <td><span t-esc="formatLang(r['quantity'])"/></td>
                                <td><span t-esc="formatLang(r['amount'])"/></td>
                                <td><span t-esc=" formatLang(r['total'], currency_obj=o.company_id and o.company_id.currency_id)"/></td>
                            </tr>
                        </tbody>
                    </table>

Could we help please?

 

อวตาร
ละทิ้ง
ผู้เขียน

I have also tried . error.

ผู้เขียน คำตอบที่ดีที่สุด

Oh YEH!

In the file : .../addons/hr_payroll/report/report_contribution_register.py

In the method : _get_payslip_lines()

I have replaced :                

'total': line.total,

By :
             'total': line.total,

 'number': line.slip_id.number,

 

Now, i will create an override in my custom module.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

you can use r.get('id')

อวตาร
ละทิ้ง
ผู้เขียน

Thanks. But you are not right. column is empty. I want the number (2014-PAY-00001) not the id.

คำตอบที่ดีที่สุด

My suggestion, you create own parser like this: https://www.odoo.com/forum/help-1/question/odoo8-reports-and-variables-transfering-71292#answer-72839

อวตาร
ละทิ้ง
ผู้เขียน

Not easy. Will see. Thanks

ผู้เขียน

May be I could override the method : def _get_payslip_lines(self, obj): In the class : « class contribution_register_report(report_sxw.rml_parse): » In the file « .../addons/hr_payroll/report/report_contribution_register.py » ???

idea ok in old style api.

ผู้เขียน

Where is the best documentation about this kind of parser?

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ม.ค. 21
804
2
เม.ย. 20
10919
0
พ.ค. 24
2234
2
พ.ค. 24
4225
Sale Order PDF Report แก้ไขแล้ว
3
ก.พ. 24
3656