Hello,
I would like to share this mini-howto about use jasperreport server, ireport and openerp 7 passing parameters. I hope this help somebody. Again, sorry for my english
1- Install jasperreport server
2- Download and extract jassperreport file for openerp from https://github.com/syleam/openerp-jasperserver. This extract two folders.
3- Install "python-pip" library from command line or synaptic
4- Download and install 3 libraries from command line: "sudo pip install httplib2 pypdf python-dime"
5- Untar the openerp jasperreport file and install the jasper_server module.
In jasperreport server:
create needed folders in jasperserver:
6- Create "openerp" folder inside the root directory
7- Create "datasources" folder inside the openerp directory
8- Create "inputs" folder inside the openerp directory
9- Create "bases" folder inside the openerp directory
10 Under "bases" folder, create a directory with the name of your working openerp database and complete the necesary data parameters.
11 In openerp go to menu /configuration/jasper report/configuration/jasperserver configuration/ and create a new database parameter access.
11 Right click over datasources folder and create a new datasource.
12 Use ireport to create a new report with a basic query without parameters
13After create the sql query, define two parameter that we are going to use to pass data from openerp.
This parameters have to be named as OERP_<name of="" parameter="">
Repeat, name of parameters must be in uppercase.
14 In jasperreport server go to tree openerp/inputs option and create an input control for each parameters you created in openerp. You have to use the same parameters name.
15 In openerp/bases/<databasename> folder create a new jasperreport resource with the same report name of your ireport report name and choose the <reportname>.jrxml file.
16 Then in "resources and controls" add two input controls from jasper server
17 In "datasources" select the repository just created
18 Create a new class inside your module ( the one you are going to call the report ) This class is used to call the report and give the parameters from openerp to jasper.
Example tested:
( change the values inside <> with yours )
class <report_class> (osv.osv):
def <nameoffunction>(self, cr, uid, ids, context=None): # you can use a button to call this funtion to execute the report
<reg> = self.browse(cr, uid, ids, context=context)[0]
data = {}
data['model'] = '<modelname>'
data['jasper'] = {
'<jasperparameter1>': <reg>.<param1>, # without "OERP_"
'<jasperparameter2': <reg>.<param2>,
}
return {
'type': 'ir.actions.report.xml',
'report_name': 'jasper.<openerp/jasperdocument/servicename>',
'datas': data,
}
_name = '<modelname>'
_columns = {
'<param1>' : fields.char('From', size=15, required=True),
'<param2>' : fields.char('To', size=15, required=True),
}
19 Now create the xml to show the report parameter form in openerp
20 In openerp go to menu configuration/jasper report/jasper document and create a new one using this parameters:
objet model = <report_class> in your module
service name = field report_name in your class without "jasper."
service unit = jasperserver report name
jasper file = jasperserver report name
21 Go to "parameter" tab and create the two parameters with the same name you write in jasperreport
22 Test
My openerp parameter screen:
My pdf jasper report screen question:
As soon as posible we are going to upload a video of the process
This is about the only information I can find about using Syleam's Jasperserver module. I still don't understand it, though. I have it installed, and I really have no idea where to go from here.
If you have a concrete question i would try to answer it.
Oscar, i've tried to understand how to use the module. What i don't understand is what to fill in service name. You've said <openerp/jasperdocument/servicename>, is this literal? Another question is what you are referring as jasperserver report name. I think is the name in jasperserver (not the jrxml file), is that right?
It is great with the information. I tried to follow the steps. At step 11, is it pointing to the Jasper server, datasources folder newly created under the openerp folder? I really wish you have time to create the video howto so that we can follow it easily. Thanks in advance.
First of all, thank you for your time and effort. In general, is this method necessary for me to print invoices through JasperServer? Or only if I want to pass parameters back and forth? I want my client to be able to do everything through the OpenERP web interface, without having to open the /jasperserver web page. As for your tutorial, I am a bit confused here: 10 Under "bases" folder, create a directory with the name of your working openerp database and complete the necesary data parameters.
Parameters? On a folder? I don't understand. Perhaps you meant something else there?
Is the best info that I found about Jasper Reports and Openerp. But I can't find "11 In openerp go to menu /configuration/jasper report/configuration/jasperserver configuration/ and create a new database parameter access." I've also the same question that @Gary Dunnaway has... Can you help me ?