openerp RML,如何在新页面中继续打印表行?

时间:2014-11-04 14:46:23

标签: python openerp row rml xmltable

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

  

“打印错误   您尝试打印的文档包含一个不适合一页的表格行。请尝试将其拆分为较小的行或与管理员联系。“

如何解决此问题?

P.S。:我尝试使用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>

1 个答案:

答案 0 :(得分: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>