0

I'm modifying OpenERP Employee Payslip RML Report, I want to Split the line by Earnings or Deductions. This is what I expect as the final result:

 _____________________________ _____________________________
| Earnings                    | Deductions                  |
|                             |                             |
| Description        Amount   | Description        Amount   |
| BASIC               7000.00 | Provident Fund      300.0   |
| House Rent           500.00 | Professional Tax    200.0   |                    
| Conveyance           200.00 |                             |
| Other Allowance      300.00 |                             |
|_____________________________|_____________________________|

But this is what I get when the length for deductions and earnings line are not the same:

 _____________________________ _____________________________
| Earnings                    | Deductions                  |
|                             |                             |
| Description        Amount   |                             |
| BASIC               7000.00 |                             |
| House Rent           500.00 | Description        Amount   |
| Conveyance           200.00 | Provident Fund      300.0   |
| Other Allowance      300.00 | Professional Tax   200.0    |
|_____________________________|_____________________________|

This is my RML:

<blockTable colWidths="270, 270">
  <tr>
    <td><para style="P15">Earnings</para></td>
    <td><para style="P15">Deductions</para></td>
  </tr>
  <tr>
    <td>
      <blockTable colWidths="200.0, 70.0">
        <tr>
          <td>Description</td>
          <td>Amount</td>
        </tr>
      </blockTable>
      <section>
        <blockTable colWidths="200.0, 70.0">
          <para style="P4">[[repeatIn(get_payslip_lines(o.line_ids, 'earnings'),'p') ]]</para>
          <tr>
            <td>[[ p['name'] ]]</td>
            <td>[[ p['amount'] ]]</td>
          </tr>
        </blockTable>
      </section>
    </td>
    <td>
      <blockTable colWidths="200.0, 70.0">
        <tr>
          <td>Description</td>
          <td>Amount</td>
        </tr>
      </blockTable>
      <section>
        <para style="P4">[[repeatIn(get_payslip_lines(o.line_ids, 'deductions'),'d') ]]</para>
        <blockTable colWidths="200.0, 70.0">
          <tr>
            <td>[[ d['name'] ]]</td>
            <td>[[ abs(d['amount']) ]]</td>
          </tr>
        </blockTable>
      </section>
    </td>
  </tr>
</blockTable>

Please advise me for the correct markup.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Edxz
  • 823
  • 2
  • 8
  • 22
  • How to separate amount items as `'earnings'` and `'deductions'`? For example `'Gross'` or `'Net` fall in neither `'earnings'` nor `'deductions'`. – Ravinder Reddy Oct 28 '14 at 09:15
  • Is the `'earnings'` obj is as returned from [`'get_earnings'`](https://github.com/vnc-biz/openerp-extra-bundle/blob/master/hr_payroll/report/report_payslip.py) method? – Ravinder Reddy Oct 28 '14 at 09:29

1 Answers1

2

What you need is to set the vertical alignment of your table cells. You have to use a <blockTableStyle> for this purpose.

<stylesheet>    
    <blockTableStyle id="T1">
        <blockValign value="TOP"/>
    </blockTableStyle>
<stylesheet>    

and after that, in your table definition:

<blockTable colWidths="270, 270"  style="T1">
    <tr>
        <td><para style="P15">Earnings</para></td>
        <td><para style="P15">Deductions</para></td>
    </tr>
    <tr>
        <td>
            <blockTable colWidths="200.0, 70.0">
                <tr>
                    <td>Description</td>
                    <td>Amount</td>
                </tr>
            </blockTable>
            <section>
                <blockTable colWidths="200.0, 70.0">
                    <para style="P4">[[repeatIn(get_payslip_lines(o.line_ids, 'earnings'),'p') ]]</para>
                    <tr>
                        <td>[[ p['name'] ]]</td>
                        <td>[[ p['amount'] ]]</td>
                    </tr>
                </blockTable>
            </section>
        </td>
...
Andrei Boyanov
  • 2,309
  • 15
  • 18
  • I used another approach , I use 1 table instead of 2 tables but thanks for the solution, will try it out :D – Edxz Nov 25 '13 at 07:54
  • @Andrei Boyanov In my report my custom table is always on centre. I tried allignment-"center". But problem continues. Is there any solutions. thanks.. – manuthalasseril May 07 '14 at 14:51
  • @manuthalasseril Give some example please. May be in separate question? – Andrei Boyanov May 15 '14 at 06:40
  • @Andrei Boyanov Thanks for your reply. My problem is same as in this qtn http://stackoverflow.com/questions/19606034/how-to-change-the-alignment-of-table-in-rml-file . Anyway I solved it as temporarily by adding another blank column to the last column and also give remaining space to that new added column. And made the table boundries invisible. – manuthalasseril May 15 '14 at 06:53