Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to generates and returns html version of a report in openerp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 448
    Comment on it

    In openerp If the report is using a custom model to render its html and fallback on the generic html rendering. report is generates and returns html version of a new report.
    use this function in your own module in .py file,

        def get_html(self, cr, uid, ids, report_name, data=None, context=None):
            """This method generates and returns html version of a report.
            """
            # If the report is using a custom model to render its html, we must use it.
            # Otherwise, fallback on the generic html rendering.
            try:
                report_model_name = 'report.%s' % report_name
                particularrepor_obj = self.pool[report_model_name]
                return particularreport_obj.render_html(cr, uid, ids, data=data, context=context)
            except KeyError:
                report = self._get_report_from_name(cr, uid, report_name)
                report_obj = self.pool[report.model]
                docs = report_obj.browse(cr, uid, ids, context=context)
                docargs = {
                    'doc_ids': ids,
                    'doc_model': report.model,
                    'docs': docs,
                }
                return self.render(cr, uid, [], report.report_name, docargs, context=context)
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: