OpenERP RML blockTable问题

时间:2013-11-17 05:40:41

标签: openerp rml

我正在修改OpenERP员工薪资单RML报告, 我想通过收入或扣除来拆分该行。 这是我期望的最终结果:

 _____________________________ _____________________________
| 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 |                             |
|_____________________________|_____________________________|

但是当扣除和收入线的长度不同时,这就是我所得到的:

 _____________________________ _____________________________
| 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    |
|_____________________________|_____________________________|

这是我的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>

请告诉我正确的标记。

1 个答案:

答案 0 :(得分:2)

您需要设置表格单元格的垂直对齐方式。你必须使用&lt; blockTableStyle&gt;以此目的。

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

之后,在你的表定义中:

<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>
...