Odoo Help


This community 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.


Add condition to RML report generation

on 6/25/14, 3:34 AM 1,491 views

Hi All,

I've prepared some custom RML report for CUSTOMERS. It's working fine for me. But I want it only for the CUSTOMERS and not for the SUPPLIERS. How can i remove or avoid the report name from being listed in the print button of SUPPLIERS.

And there's one more condition for CUSTOMERS, i.e., suppose there's a custom boolean flag i've added in the partner table for the CUSTOMERS. So i want the report to be generated only for those CUSTOMERS, where this flag is TRUE or 1.

Please help me with this. Any help would be appreciated :)

ASP :)

can u post your rml code ?..

on 6/25/14, 4:21 AM

Hi Prakash, Can we add something in the .py file of the report to achieve the above? My RML code is very long and I can't post it here. Please help me. I really need a way to do this. Can you please suggest something specific or give any example of code snippet where i need to change. Thanks for your reply :)

on 6/25/14, 7:04 AM

Just post your two lines rml main code for loop and object.name code.

on 6/25/14, 7:09 AM

To add a filter in rml code itself. otherwise write a function which passes the data and the function should return the filtered customer to RML parser.

on 6/25/14, 7:14 AM

Thanks for ur quick response Prakash :) But how can i restrict the report to be generated for SUPPLIERS or how to remove it from the print button list at the top of any supplier. As this report is only for CUSTOMERS.

on 6/25/14, 9:05 AM
On 6/30/14, 6:48 AM

Thanks Ray for the reply, so what u r suggesting is to print something informative as "THIS REPORT NOT VALID FOR SUPPLIERS" on the pdf report if we are printing for any supplier. I can go with this, but :) my requirement is to restrict the PDF generation in this case. So i was just wondering if we could use any "context" or "domain" to add filters in the report tag defined in the XML file or something like that. Once again thanks for ur reply. :) Cheers ASP


Ray Carnes

--Ray Carnes--
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

Ray Carnes
On 6/25/14, 2:47 PM

Reports are tied to a model, so I don't think you can do this.  

You could have a condition in the RML that prints 'THIS REPORT NOT VALID FOR SUPPLIERS'.

Take a look at how the Quotation / Order report changes according to the state of the sale.order record.

Your Answer

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 6/25/14, 3:34 AM
Seen: 1491 times
Last updated: 3/16/15, 8:10 AM