This question has been flagged
1 Reply
3002 Views

I am trying to print a RML report in the 7.0 version. The report shows a list of elements (when their properties x and y are 0.0) in a table, each one in a different row. It works well, except for one case: when the list is empty, it gives an error. So I am racking my brains to know how to control that condition, I am a newbie in this and I cannot understand why the next lines are not working:

<blockTable  style="my_style">

    <tr>

        [[repeatIn(report.line_ids, 'line')]]

        [[line and (line.x==0.0 and line.y==0.0 and removeParentNode('tr')) or removeParentNode('blockTable')]]

        <td> ... </td>

    </tr>

</blockTable>

Please any answer or reference to a tutorial of dynamic RML reports (like this, but unfortunately, this one was not enough: https://doc.openerp.com/v6.0/developer/3_11_reports/11_1_openoffice_report.html/#dynamic-content-in-openoffice-reports) or something similar will be appreciated a lot. Thank you in advance!

EDIT

Thank you Leonardo! I tried both solutions but the error is still there. My table was divided in five columns, so I have to write not only an empty <tr></tr> but five <td></td> too! But now it works!!

Avatar
Discard
Best Answer

I found myself with the same problem and, as far as I recall, it was due to the fact that you can't have a <blockTable> without <tr> inside, which is what happens if the list is empty.

I solved the problem by putting a "fake" empty first line (<tr><para>  </para></tr>) so that there is at least always one line , but I think you could try, as a better solution, to change your repeatIn line with this one:

[[report.line_ids and repeatIn(report.line_ids, 'line') or removeParentNode('blockTable')]]

 

Avatar
Discard