Odoo Help


Create another model's report from wizard

Jignesh Mehta
on 3/1/16, 4:55 AM 1,333 views


I have one wizard which have start date and end date.

Now, I want report between this two dates for another model.

I can search the record between the dates in model but in the report, wizard's id is pass.

How can i pass this search id which is from another model.

class TreeIssueDateWiseReport(models.TransientModel):

    _name = 'tree.issue.date.wise.report'

    _description = "Tree Issue Date Wise Report"

    start_date = fields.Date('Start Date', required=True)

    end_date = fields.Date('End Date', required=True)


    def calculate_report(self):


        data = {}

        data['ids'] = self.env.context.get('active_ids', [])

        data['model'] = self.env.context.get('active_model', 'ir.ui.menu')

        data['form'] = self.read(['start_date', 'end_date'])[0]

        tree_search_obj = self.env['tree.temp'].search([('date', '>=', self.start_date), ('date', '<=', self.end_date)]).ids

        # data['form'] = tree_search_obj

        # docargs = {

            # 'tree': tree_search_obj,

            # 'wizard': self.id,

        # }

        datas = {

            'ids': tree_search_obj,

            'model': 'tree.temp',

            'form': tree_search_obj,


        return {

            'type': 'ir.actions.report.xml',

            'report_name': 'work_order.report_tree_issue_date',

            'datas': datas}

        # self.render_html()

        # return self.env['report'].get_action(self, 'work_order.report_tree_issue_date', data=docargs)]


    def render_html(self, data=None):

        print "data ::::::::::::::: ", data

        print "self =============== ", self

        report_obj = self.env['report']

        report = report_obj._get_report_from_name('work_order.report_tree_issue_date')

        tree_search_obj = self.env['tree.temp'].search([('date', '>=', self.start_date), ('date', '<=', self.end_date)]).ids

        docargs = {

            'doc_ids': tree_search_obj,

            'doc_model': 'tree.temp',

            'docs': tree_search_obj,


        return report_obj.render('work_order.report_tree_issue_date', docargs)

Thanks in advance,

any update ??

Jignesh Mehta
on 3/1/16, 10:45 PM

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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 3/1/16, 4:55 AM
Seen: 1333 times
Last updated: 3/1/16, 10:44 PM