This question has been flagged
1 Reply
29450 Views

Hello,

I am looking for documentation/example modules or anything were I can learn how to create a report from a wizard. The ending report should use the variables passed by the wizard to generate the PDF.

For example a report that would show only the rows in my module were the date field is June.

I already have the wizard working but I don't understand how to link the print button to a report or even how to send the variables to be able to generate the report with them.

Any module or documentation that anyone can point me would be much appreciated as I couldn't find much.

Thanks in advance

Avatar
Discard

hi, i have the same need. i created report, added it to open erp,my report is of type pentaho.when clicking print it shows entire data, filtering not works.my form is same as Reports/point of sale/sale Details, the difference is that i am using pentaho reporting.How can i filter data please help

Can you help me in saving the Partner Ledger Report (webkit) to attachments, it has a many2many field partner_ids, i want to save the pdf as partner_name.pdf, please help in writing the expression for that.

Best Answer

Hi Yokito,

I am giving you the simplest way to generate report from wizard. Just follow the steps:

(1) Make a simple report in your report.xml file.

(2) Make a simple wizard with a button

Button 1-For generate report

(3) On a button call a method like this,

def print_report(self, cr, uid, ids, context=None):
    datas = {}
    if context is None:
        context = {}
    data = self.read(cr, uid, ids)[0]
    datas = {
                 'ids': [],
                 'model': 'object.object',
                 'form': data
    }
    return {'type': 'ir.actions.report.xml', 'report_name': 'your_report_name', 'datas': datas}

(3) Start your server, update your module, open a wizard you created click on the button and then the report will print.

Hope these guidelines are helpful to generate report from wizard.

Thanks.

Avatar
Discard
Author

Thanks, so datas is passing the variables from my form, right? And I can access them through a function in my report_name.py?

Yes sure. By repeatIn in rml you can have a loop if you have multiple records or you can call a function from rml file. Take a look at this link http://bazaar.launchpad.net/~openerp/openobject-addons/7.0/view/head:/point_of_sale/report/account_statement.rml#L155

hi, i have the same need. i created report, added it to open erp,my report is of type pentaho.when clicking print it shows entire data, filtering not works.my form is same as Reports/point of sale/sale Details, the difference is that i am using pentaho reporting.How can i filter data please help

Sorry but I have not any idea about Pentaho reports. But I think it would be same as for the other reports.

I am calling an already created report of mine which shows the list of the invoices. I added two fields date_from n date_to to the wizard that prints this report but i am not able to print these dates on the report. Please help. here is the link to my detailed question http://help.openerp.com/question/34705/print-value-of-a-field-in-wizard-to-report/

Hi! I did that but then my wizard doesn't close, do you have any suggestion?

I created a sample report from wizard, but the report seems to be blank. How can I solve it.