This question has been flagged
1 Reply
4948 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)

Avatar
Discard
Best Answer

hi Praven did you find the solution ? i have the same issue 

Avatar
Discard

Did you find the solution? Same issue here

hi in fact i find a solution is not as i wished but for me it was good.. so i just put the content of each "report" in div related to field in my form views with condition in way that if the field is true or exist i will show th div related with this field ... if u want more explain let me know