India

ZestyBeanz Technologies Pvt Ltd 4th Floor, Nila, Technopark Thiruvananthapuram,
India – 695581
Phone: +91 471 4063254
Fax : +91 471 2700171

   .

ZestyBeanz Technologies Pvt Ltd
61/3236, Manikkath Cross Road
Ravipuram, Kochi, India - 682016
Phone: +91 484 4063254

  UAE

Zesty Labs
Office # 2003, Millennium Plaza Building
Sheikh Zayed Rd, Dubai, UAE
Phone: +971 4333 2222​
Mobile: +971-52-7553466

  Germany​

ZestyBeanz Technologies GmbH
Reuterstraße 1
90408 Nürnberg
Fon: +49 911 4801 444
Fax: +49 911 4801 445

Creating a Jasper Report using osv_memory in OpenERP

Contact Form


omalbastin's picture

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.

AttachmentSize
report_using_osv_memory.zip21.96 KB

walid's picture

Hello, I'm starting with

Hello,
I'm starting with openerp 6 I want to create a form with two fields (start_date and end_date) and print button I want when I click the print button, I get a pdf repport that contains the list of users that are added between the two dates

Help me please

walid's picture

Hello, I'm starting with

Hello,
I'm starting with openerp 6
I want to create a form with two fields (start_date and end_date) and print button
I want when I click the print button, I get a pdf repport that contains the list of users that are added between the two dates

Help me please

walid's picture

Hello, I installed the

Hello,
I installed the "Jasper Report using osv_memory" in OpenERP 6 all went without error but it returned me empty pdf

help me please

omalbastin's picture

Please check the data you are

Please check the data you are passing to jasper reports. Take a look at the data you are returning from gererate_records() function from your report parser.

walid's picture

Please, I'm a beginner, I did

Please, I'm a beginner, I did not understand

omalbastin's picture

In the module, goto

In the module, goto report/report_user_analysis.py, there you can find a function called generate_records(). Please check the value it return

walid's picture

returns nothing

returns nothing

omalbastin's picture

please check in a database

please check in a database with demo data.Empty pdf wil be generated if no data is passed to jasper. Values to the report should be passed from this generate_record() function as a list of dictionaries,

Anonymous's picture

Sir, Can you please explain

Sir, Can you please explain about how to configure jasper report with openerp

Anonymous's picture

Hi Omal Thanks for the great

Hi Omal

Thanks for the great example.

I have installed your module on OpenERP 6.0.2, but the option to change the format of the report from 'pdf' to 'xls' or 'html' does not work - the report is always a 'pdf'

Is this something you tested on your system and it worked?

Thanks