Odoo Help


Remove blockTable from empty filter

on 3/6/13, 3:46 AM 2,797 views

In OpenOffice Writer, how is it possible to remove a blockTable when a loop filter is empty.

In my sales quotation report, I have the following loop code that is meant to return all sale order lines that contain the word "sample":

repeatIn(filter(lambda x: "sample" in x.product_id.categ_id.complete_name,so.order_line),'o')

This works fine and with the addition of a formula o.name, it prints out all the requested lines.

I have put this code within a single table cell.

It works for as long as the condition is true, but if I have a sale order with absolutely no sample in any of the lines, then I get an error message saying the table cannot be empty.

So how is it possible to remove that table altogether, using the removeParentNode("blockTable") somewhere?

I actually over read Andreas' first solution. The logic works and it removes the blockTable when no order lines contain the word "sample".

But it prints the following out in the table that needs to be shown: [browse_record(sale.order.line, 96)]

I have tried to put an And '' before the or, but the table disappears again altogether, "sample" found or not.

on 3/6/13, 11:43 AM

For some unknown to me reason, on my windows install I must generate the rml from OpenOfficeWriter and then send the report to the server (using the Ooo Writer functionality). Otherwise OpenERP points to the previous version of the rml file. Until I find the reason I can't edit the rml file manually. Amazingly enough, I use that rml file on my ubuntu server and I never had to send anything to the server...

on 3/6/13, 2:24 PM

You can try to use a tag/components which does not display the content. Or try to set the font color to white ...

Andreas Brueckl
on 3/7/13, 6:54 AM

Andreas Brueckl

--Andreas Brueckl--

| 7 8 7
Vienna, Austria
--Andreas Brueckl--
OpenERP Consulting and Development
Andreas Brueckl
On 3/6/13, 3:57 AM

Try the following line:

[[ filter(lambda x: "sample" in x.product_id.categ_id.complete_name,so.order_line) or removeParentNode("BlockTable") ]]


If you put the line right after the starting <blockTable> tag, then the "browse(.." should not be displayed. I always edit the RML manually so I do not know whether this is possible in OpenOffice.

Tried that. It gets rid of the table regardless of the content, whether an order line contains sample or not.

on 3/6/13, 5:23 AM

I am not sure whether OpenERP is case-sensitive in this case, but it should by "blockTable" and not "BlockTable". Please also check the logfiles, whether there are any errors or warnings.

Andreas Brueckl
on 3/6/13, 5:29 AM

My code actually states "blockTable" unlike my initial message which I have just edited. I believe the interpretation is case sensitive and I do respect this in my coding.

on 3/6/13, 5:40 AM

Whats about the log file?

Andreas Brueckl
on 3/6/13, 5:50 AM

Running my development and testing openerp on windows, I have not managed to get a log file to be generated. Production db is on Ubuntu but that's beside the point...

on 3/6/13, 6:35 AM

Managed to get the log file going, but it doesn't mention anything about an error occuring, only GET and POST lines.

on 3/6/13, 9:49 AM

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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 3/6/13, 3:46 AM
Seen: 2797 times
Last updated: 3/16/15, 8:10 AM