Odoo Help

Welcome!

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.

1

How to hide/invisible one of the print reports under Print Button depending conditions

By
Praveen Upadhyaya
on 5/19/14, 8:05 AM 994 views

I have generated two reports using two different rml  files for same class under the same Print button, i want to hide one of them based of the value in a field in the form

Please help me I am trying to do this but not working 

class esteem_wps_report(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(esteem_wps_report, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({'time': time})

class esteem_wps_report_9595(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(esteem_wps_report_9595, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({'time': time})


def test_report(self, cr, uid, ids, context=None):
    wps = self.pool.get("esteem_wps")
    for id in ids:
        val = wps.browse(cr, uid, id).select_wp
        if (val == "qw_482"):
            report_sxw.report_sxw('report.esteem_wps_report', 'esteem_wps','addons/esteem_wps/report/wps_report.rml',parser=esteem_wps_report)
        else:
            report_sxw.report_sxw('report.esteem_wps_report_9595', 'esteem_wps','addons/esteem_wps/report/wps_report_9595.rml',parser=esteem_wps_report_9595)

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

1 follower(s)

Stats

Asked: 5/19/14, 8:05 AM
Seen: 994 times
Last updated: 1/7/16, 1:13 PM