Odoo Help

0

0
3 Answers
0
Stefan
5/29/19, 7:59 AM

Hello Rishan,

You can do like below.

i n  render_html you can raise error message, if you set you report names like below

class YourModuleName (models.AbstractModel):

_ name = 'report.module_name.template_name'

@ api.multi
def render_html (self, docids, data = None):
    report_obj = self.env ['report']
    raise UserError (_ ('Example Error Message!')) 
    report = report_obj._get_report_from_name ('modulename.template_name' ) 
    docargs = {} 
    docargs.update ({
        'doc_ids': docids,
        'doc_model': 'mrp.production',
        'docs': mrp,
})
return report_obj.render ('modulename.template_name', docargs)

in report view

<report> .....

file = "modulename.template_name" 
name = "modulename.template_name"

and..

<template  ​id  ="template_name">

Please try like this if not worked, Please ask me.


Ask a Question
Writer
Keep Informed
1 follower(s)
About This Community

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

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now