Passing context to qweb report for managing table visibility - odoo -


how can pass context value qweb report can control visibility of tables. have qweb report lot of tables. depending on selection list, want control view of these tables in qweb report. option control using context. didn't find way pass context. if there other opinion, please share.

create parser class first

import time openerp.osv import osv openerp.report import report_sxw  class sale_quotation_report(report_sxw.rml_parse):      def __init__(self, cr, uid, name, context):          super(sale_quotation_report, self).__init__(cr, uid, name, context=context)             self.localcontext.update({                     ‘key’: value,                     ‘function_name’: self.function_name,             })      def function_name(self):         ### add code if required.. 

then define class

class report_saleorderqweb(osv.abstractmodel):     _name = ‘module_name.report_sale_order_qweb’     _inherit = ‘report.abstract_report’     _template = ‘module_name.report_sale_order_qweb’     _wrapped_report_class = sale_quotation_report 

then can call localcontext method in way

<span t-esc=”function_name(parameter)”/> 

refer our blog on qweb report


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -