0

In an RML template, is it possible to remove several nodes at once? Or is it possible to group several nodes into one, and then remove the whole group?

I have tried putting several "para" elements within a "pto", and then do "removeParentNode('pto')", but it didn't make any difference. Either removeParentNode does not work on "pto" elements, or maybe it removes just the "pto" and leaves the "para" children as is?

Thanks!

Jānis Elmeris
  • 1,975
  • 1
  • 25
  • 43

1 Answers1

3

You should be able to wrap several para elements in a section element and remove the section. See the picking report for an example.

<section>
  <para style="terp_default_2">[[ repeatIn([line for line in picking.move_lines if ((line.state == 'confirmed' or line.state=='done' or line.state=='assigned') and not line.scrapped)],'move_lines') ]]</para>
  <para style="terp_default_2">[[ (picking.move_lines!=[] and removeParentNode('para')) or removeParentNode('section')]]</para>
  <blockTable colWidths="256.0,74.0,58.0,60.0,73.0" style="Move_Line_Contect_Assign_State">
    <tr>
      <td>
        <para style="terp_default_9"><font face="Helvetica" size="9.0">[ [[ (move_lines.product_id.default_code) or removeParentNode('font') ]] ]</font> [[ move_lines.product_id.name ]] [[ move_lines.product_id.variants or '']] </para>
      </td>
      <td>
        <para style="terp_default_Centre_9">[[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]</para>
      </td>
      <td>
        <para style="terp_default_9">[[ move_lines.state ]]</para>
      </td>
      <td>
        <para style="terp_default_Right_9">[[ (move_lines.location_id and move_lines.location_id.name) or '' ]] </para>
      </td>
      <td>
        <para style="terp_default_Right_9">[[ formatLang(move_lines.product_qty) ]] [[ move_lines.product_uom.name ]]</para>
      </td>
    </tr>
  </blockTable>
</section>
Don Kirkby
  • 53,582
  • 27
  • 205
  • 286
  • Thanks for the pointer! I cannot find "section" tag in the RML specification: http://www.reportlab.com/docs/rml.dtd I also succeeded in wrapping in "pto" element and remove it, but only if the removing of the element is placed in the beginning of "pto"'s content. If there already is a "para" tag to output and only then I try to remove the wrapping "pto", an error occurs. Also, for example, if I have a tag within at one point, and then, at the end, out of the tag I try to remove , I get an error. – Jānis Elmeris May 14 '12 at 14:23