Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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:
[[line and (line.x==0.0 and line.y==0.0 and removeParentNode('tr')) or removeParentNode('blockTable')]]
<td> ... </td>
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!
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!!
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')]]
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 6/19/14, 12:08 PM|
|Seen: 855 times|
|Last updated: 3/16/15, 8:10 AM|