Odoo Help

Welcome!

This community 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.

0

OpenERP 7.0 Jasper_Reports use with JDBC Datasource

By
jsallent
on 9/15/14, 11:28 AM 632 views

Good afternoon, 

I'm using OpenERP 7.0 with Jasper_reports for the preparation of reports. 

The connection I use is using JDBC datasource to access the database without problems.

The version used in Jasper_reports is to NanTic. 

The issue is I have a report created with iReport and if I run it in iReport with <preview> works perfectly !!!

Query details

SELECT

     iqcirugia."id" AS iqcirugia_id,

     iqcirugia."create_uid" AS iqcirugia_create_uid,

     iqcirugia."create_date" AS iqcirugia_create_date,

     iqcirugia."write_date" AS iqcirugia_write_date,

     iqcirugia."write_uid" AS iqcirugia_write_uid,

     iqcirugia."autoriza" AS iqcirugia_autoriza,

    ...

    ...

     res_company."attachment_num" AS res_company_attachment_num,

     res_company."logo_topbar" AS res_company_logo_topbar

FROM

     "public"."iqcirugia" iqcirugia INNER JOIN "public"."iqcirugia_location" iqcirugia_location ON iqcirugia."id" = iqcirugia_location."cirugia_id"

     INNER JOIN "public"."stock_location" stock_location ON iqcirugia_location."location_id" = stock_location."id"

     INNER JOIN "public"."res_company" res_company ON iqcirugia."company_id" = res_company."id"

WHERE

     $X{ IN ,(iqcirugia.id::varchar),PIDS}

 

In the report, I have created 2 parameters (IDS, PIDS)

Parameter 1 -> IDS

 

Imágenes integradas 1

 

 

Imágenes integradas 2

 

Parameter 2 -> PIDS

 

Imágenes integradas 3

The problem is that when I run it from OpenERP did not properly collects the record ID I'm positioned. 

I mean, if I'm positioned in register 1 to 9 works fine, but when that position myself in the ID 11, 12, 13.... loses first character ... I mean if I give ID 13 to print the record, the report prints ID 3??

jasper_report.py details:

 

 def executeReport(self, dataFile, outputFile, subreportDataFiles):

        locale = self.context.get('lang', 'en_US')

        connectionParameters = {

            'output': self.outputFormat,

            #'xml': dataFile,

            'csv': dataFile,

            'dsn': self.dsn(),

            'user': self.userName(),

            'password': self.password(),

            'subreports': subreportDataFiles,

        }

        parameters = {

            'STANDARD_DIR': self.report.standardDirectory(),

            'REPORT_LOCALE': locale,

            #'IDS': self.ids,    

            'IDS': ','.join(map(str,self.ids)),

 

As you can see, I have included modifications to the code jaspert_report.py in ExecuteReport method but since I did not reflect correctly the ID. 

 

If I put the default, for example:

..

result = {'13'}

..

y then

  'IDS': ','.join(map(str,result)),

It still prints register ID=3.

 

Do you have encountered this problem? 

Thanks in advance

Juan

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/15/14, 11:28 AM
Seen: 632 times
Last updated: 3/16/15, 8:10 AM