1

我必须打印一张可能会占用一页以上的表格,具体取决于其大小。为此,我使用 blockTable 进行了 repeatIn,它逐一打印行,但是当它接近页面末尾时,openerp 显示以下错误消息:

“打印错误您尝试打印的文档包含一页无法容纳的表格行。请尝试将其拆分为较小的行或联系您的管理员。”

如何解决这个问题?

PS:我尝试使用 condPageBreak 但似乎不适用于此标签。

下面是我的代码:

<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(842.0,595.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first"> <!-- 481 728 -->
  <frame id="first" x1="57.0" y1="57.0" width="750" height="500"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla1">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla2">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla3">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla5">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla4">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla6">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla7">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla8">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
  <blockFont name="Helvetica" size="8" />
  <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
  <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
</blockTableStyle>

<blockTableStyle id="Tabla9">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
  <lineStyle kind="GRID" colorName="#000000"  />
  <lineStyle kind="GRID" colorName="#000000"  />
</blockTableStyle>

<blockTableStyle id="Tabla10">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla11">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<initialize>
  <paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="14.0" leading="17"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="12.0" leading="15"/>
<paraStyle name="P3" fontName="Helvetica" fontSize="8.0" leading="11" alignment="LEFT"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
<paraStyle name="P9" fontName="Helvetica" fontSize="7.0" leading="13" alignment="CENTER"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0"         spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="Table Contents" fontName="Helvetica"/>
<images/>
</stylesheet>
<story>
<para style="P3">[[ repeatIn(objects,'partida') ]]</para>
<para style="P1">Registro de Contralor</para>
<para style="P3">
  <font color="white"> </font>
</para>
<para style="P3">
  <font color="white"> </font>
</para>
<blockTable colWidths="74.0,408.0" style="Tabla1">
  <tr>
    <td>
      <para style="P3">Período:</para>
    </td>
    <td>
   <para style="P5">[[ partida.period_id.name ]]</para>
    </td>
  </tr>
  <tr>
    <td>
      <para style="P3">Moneda:</para>
    </td>
    <td>
      <para style="P5">[[ partida.currency_id.name ]]</para>
    </td>
  </tr>
  <tr>
    <td>
      <para style="P3">Misión:</para>
    </td>
    <td>
      <para style="P5">[[ partida.company_id.name ]]</para>
    </td>
  </tr>
</blockTable>
<para style="P3">
  <font color="white"></font>
</para>
<blockTable style="Tabla2">
  <tr>
    <td>
      <para style="P3">Líneas de contralor</para>
    </td>
  </tr>
  <tr>
    <td>
      <blockTable colWidths="80,60,105,105,80,60,60,80,80" style="Tabla9">
    <tr>
    <td><para style="P9">Factura</para></td>
    <td><para style="P9">Fecha de pago</para></td>
    <td><para style="P9">Cód./Obj. del gasto</para></td>
    <td><para style="P9">Partida descripción</para></td>
    <td><para style="P9">Factura original</para></td>
    <td><para style="P9">Ingreso</para></td>
    <td><para style="P9">Egreso</para></td>
    <td><para style="P9">Ref. de pago</para></td>
    <td><para style="P9">Diario</para></td>
    </tr>
   </blockTable>
<section>
       <para style="P3">[[ repeatIn(partida.contralor_ids,'contralor_id') ]]</para>
   <blockTable colWidths="80,60,105,105,80,60,60,80,80" style="Tabla9">
        <tr>
          <td>
            <para style="P9">[[ contralor_id.invoice_id.number ]]</para>
          </td>
          <td>
            <para style="P9">[[formatLang(contralor_id.fecha_pago,date=True)[:2] ]]/[[ formatLang(contralor_id.fecha_pago,date=True)[3:5] ]]/[[ formatLang(contralor_id.fecha_pago,date=True)[6:10] ]]</para>
          </td>
          <td>
            <para style="P9">[[ contralor_id.product_id.name ]]</para>
          </td>
          <td>
            <para style="P9">[[ contralor_id.partida_id.name ]]</para>
          </td>
          <td>
            <para style="P9">[[ contralor_id.invoice_original_id.number ]]</para>
          </td>
          <td>
            <para style="P9">[[ ('%.2f' % contralor_id.ingreso).replace('.', ',') ]]</para>
          </td>
          <td>
            <para style="P9">[[ ('%.2f' % contralor_id.egreso).replace('.', ',') ]]</para>
          </td>
          <td>
            <para style="P9">[[ contralor_id.ref_pago ]]</para>
          </td>
          <td>
            <para style="P9">[[ contralor_id.journal_id.name ]]</para>
          </td>
        </tr>
      </blockTable>
</section>
    </td>
    <td>
    </td>
  </tr>
</blockTable>
</story>
</document>
4

1 回答 1

0

我发现错误在哪里!blockTable 位于 td 标记内,似乎 RML 不允许您拆分 td 内的 blockTable 行。然后我将 blockTable 从另一个外部表的 td 中取出,问题就解决了。

这是我的固定代码:

<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(842.0,595.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first"> <!-- 481 728 -->
  <frame id="first" x1="57.0" y1="57.0" width="750" height="500"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla1">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla2">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla3">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla5">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla4">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla6">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla7">
  <blockAlignment value="LEFT"/>
  <blockLeftPadding length="15"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla8">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
  <blockFont name="Helvetica" size="8" />
  <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
  <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
</blockTableStyle>

<blockTableStyle id="Tabla9">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
  <lineStyle kind="GRID" colorName="#000000"  />
  <lineStyle kind="GRID" colorName="#000000"  />
</blockTableStyle>

<blockTableStyle id="Tabla10">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tabla11">
  <blockAlignment value="LEFT"/>
  <blockValign value="TOP"/>
</blockTableStyle>
<initialize>
  <paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="14.0" leading="17"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="12.0" leading="15"/>
<paraStyle name="P3" fontName="Helvetica" fontSize="8.0" leading="11" alignment="LEFT"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
<paraStyle name="P9" fontName="Helvetica" fontSize="7.0" leading="13" alignment="CENTER"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="Table Contents" fontName="Helvetica"/>
<images/>
</stylesheet>
<story>
<para style="P3">[[ repeatIn(objects,'partida') ]]</para>
<para style="P1">Registro de Contralor</para>
<para style="P3">
  <font color="white"> </font>
</para>
<para style="P3">
  <font color="white"> </font>
</para>
<blockTable>
<tr>
<td>
<blockTable colWidths="105.0,350.0" style="Tabla1">
  <tr>
    <td>
      <para style="P3">Período:</para>
    </td>
    <td>
   <para style="P5">[[ partida.period_id.name ]]</para>
    </td>
  </tr>
  <tr>
    <td>
      <para style="P3">Moneda:</para>
    </td>
    <td>
      <para style="P5">[[ partida.currency_id.name ]]</para>
    </td>
  </tr>
  <tr>
    <td>
      <para style="P3">Misión:</para>
    </td>
    <td>
      <para style="P5">[[ partida.company_id.name ]]</para>
    </td>
  </tr>
  <tr>
<td>
   <para style="P3">Líneas de contralor</para>
</td>
<td>
   <para></para>
</td>
  </tr>
</blockTable>
</td>
<td>
</td>
</tr>
</blockTable>
<para style="P3">
  <font color="white"></font>
</para>
      <blockTable rowHeights="30" repeatRows="1" colWidths="80,60,105,105,80,60,60,80,80" style="Tabla9">
    <tr>
    <td><para style="P9">Factura</para></td>
    <td><para style="P9">Fecha de pago</para></td>
    <td><para style="P9">Cód./Obj. del gasto</para></td>
    <td><para style="P9">Partida descripción</para></td>
    <td><para style="P9">Factura original</para></td>
    <td><para style="P9">Ingreso</para></td>
    <td><para style="P9">Egreso</para></td>
    <td><para style="P9">Ref. de pago</para></td>
    <td><para style="P9">Diario</para></td>
    </tr>
   </blockTable>
<section>
       <para style="P3">[[ repeatIn(partida.contralor_ids,'contralor_id') ]]</para>
   <blockTable colWidths="80,60,105,105,80,60,60,80,80" style="Tabla9">
        <tr>
          <td>
            <para style="P9">[[ contralor_id.invoice_id.number ]]</para>
          </td>
          <td>
            <para style="P9">[[ formatLang(contralor_id.fecha_pago,date=True)[:2] ]]/[[ formatLang(contralor_id.fecha_pago,date=True)[3:5] ]]/[[ formatLang(contralor_id.fecha_pago,date=True)[6:10] ]]</para>
          </td>
          <td>
            <para style="P9">[[  len(contralor_id.product_id.name) > 100 and contralor_id.product_id.name[:100] + ' ...' or contralor_id.product_id.name ]]</para>
          </td> 
          <td>
            <para style="P9">[[  len(contralor_id.partida_id.name) > 100 and contralor_id.partida_id.name[:100] + ' ...' or contralor_id.partida_id.name ]]</para>
          </td>
          <td>
            <para style="P9">[[ contralor_id.invoice_original_id.number ]]</para>
          </td>
          <td>
            <para style="P9">[[ ('%.2f' % contralor_id.ingreso).replace('.', ',') ]]</para>
          </td>
          <td>
            <para style="P9">[[ ('%.2f' % contralor_id.egreso).replace('.', ',') ]]</para>
          </td>
          <td>
            <para style="P9">[[ len(contralor_id.ref_pago) > 100 and contralor_id.ref_pago[:100] + ' ...' or contralor_id.ref_pago ]]</para>
          </td>
          <td>
            <para style="P9">[[ len(contralor_id.journal_id.name) > 100 and     contralor_id.journal_id.name[:100] + ' ...' or contralor_id.journal_id.name ]]</para>
          </td>
        </tr>
      </blockTable>
</section>
</story>
</document>
于 2014-11-06T13:27:51.047 回答