Creating a Jasper Report using osv_memory in OpenERP
I first started using Jasper Report for OpenERP 5. I used a wizard( created using wizard.interface) and the data provided in the wizard is passed to the Jasper Report module and that's it. A well aligned attractive report is created in pdf, xls, html or txt format respective to the report type I provide in the wizard. This works well in openerp-client as well as openerp-web. Then I get a chance to create the Jasper Report in OpenERP v6. It was simple to change the same jasper report module of openerp5 to openerp6 and it works fine in openerp-client. But when I opened openrp- web and tried to create the report some unknown characters are printed in the html page and only the html report is working correctly. I spent hours in this issue and then Jabir, one of the hardcore programmer of zbeanz told me that openerp6 had stopped providing support to wizard.interface and told me to use the osv_memory to create the wizard. So I started creating Jasper Report using osv_memory.
When creating a wizard using osv.osv_memory we need to create a model and view for the wizard, the same process we use to create a model and view using osv.osv. The main difference inusing osv.osv and osv.osv_memory is that it osv_memory doesnt create tables in the database and osv_memory creates a table in the memory only when the wizard model is active.
If we are creating a multi-stage(multi-state) wizard then each stage depends on the value 'state' defined in the field of the wizard model
For the state field we have to provide a default value. When we click on the wizard the view depends on this default state.We also have to define some functions that return a value to the next state or returns a value to the report. In my wizard there is only one stage in which when I click on the create button a report(Jasper report ) is created. The function is given below.
Here 'report_name' is the name of the report. This is the place where our jasper report is called. I'm providing the name of the jasper report that is already created myself. At the report module we get the 'datas' from the data. And data['form'] will give all the values provided in the wizard model. Here id and ids are not necessary. 'nodestroy' is for not destroying the wizard when creating the report.
VIEW PART
Define the record then define form. Inside the form define group for each state.
Inside this group define all the fields that should display in this stage. Then create buttons, one for cancelling the wizard and other for creating the report.
The object type button has the name create_report which is a function defined in the wizard model. After creating the report define the actions and also specify the jasper report file location. Create the menuitem where you want to display the wizard.
Our wizard creation is now complete and now restart our server and update our module, the new wizard will start working. We The ZbeanZ team are providing this module to the users who are interested in Jasper Report creation using osv_memory so that you people can check it out. I have attached the module with iths article. If there is any doubt feel free to contact us.
Attachment | Size |
---|---|
report_using_osv_memory.zip | 21.96 KB |
hi i write a wizard,the
hi
i write a wizard,the wizard thus not invoke the report.when am clicking the report button the window will close."it shows
(, KeyError('report.anabond_sale_report',), )
but am having that report in correct location.
hei budd.. i need ur help..
hei budd.. i need ur help.. i have install this module.. but error like this " File "/home/adsoft/OpenObject/addons-openerp-indonesia/jasper_reports/jasper_report.py", line 232, in __init__ if name in netsvc.SERVICES:AttributeError: 'module' object has no attribute 'SERVICES' " im installed on openerpv6.02... thanks b4
HIplease use this jasper
HIplease use this jasper reporthttp://dl.dropbox.com/u/12447821/jasper_reports.zip
Infact that module is not
Infact that module is not work indipendent. Actually the intelligence behind the working of that module is modified version of 'jasper_report' module by NAN. Dinil UD <[email protected]>