OpenERP 6.1 - Jasper Server fails on print report

Bug #934068 reported by lambdasoftware
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
JasperReport Server Connector
Fix Released
Low
Christophe CHAUVET
6.1
Fix Released
Low
Christophe CHAUVET
Odoo Web (MOVED TO GITHUB)
Invalid
Undecided
Unassigned

Bug Description

Hi, when I tried to print the report example partner_list fails with:

2012-02-17 09:42:33,730 5439 ERROR ? openerp.service.web_services: Exception: 'NoneType' object has no attribute 'browse'
Traceback (most recent call last):
  File "/home/joseba/src/openerp_v61/openerp-server61/openerp/service/web_services.py", line 710, in go
    (result, format) = obj.create(cr, uid, ids, datas, context)
  File "/home/joseba/src/openerp_v61/otros_modulos/jasper_server/jasper.py", line 46, in create
    return Report(self.name, cr, uid, ids, data, context).execute()
  File "/home/joseba/src/openerp_v61/otros_modulos/jasper_server/report/report_soap.py", line 407, in execute
    (content, duplicate) = self._jasper_execute(ex, doc, js, pdf_list, ids, context=context)
  File "/home/joseba/src/openerp_v61/otros_modulos/jasper_server/report/report_soap.py", line 113, in _jasper_execute
    cur_obj = self.model_obj.browse(self.cr, self.uid, ex, context=context)
AttributeError: 'NoneType' object has no attribute 'browse'
2012-02-17 09:42:33,978 5439 ERROR ? openerp.netsvc: 'NoneType' object has no attribute 'browse'
(<type 'exceptions.AttributeError'>, AttributeError("'NoneType' object has no attribute 'browse'",), <traceback object at 0x4d633f8>)

I tried with a form, with a tree and many ids selected, . . .

I have configured:
 - jasper server installed
 - link to jasper server from openerp (your module)

OpenERP 6.1 (web client)
Japer Server 4.5.0

Thx
JuanjoA

Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Hi

Which revision of Connector did you use ?

Regards,

Revision history for this message
lambdasoftware (lambdasoftware) wrote :

Hi, thx for your help.

openerp-server 6.1 (revno 4078)
ubuntu 11.10

1/ new database with demo data

2/ install jasper server module (revno 257, module version 6.6.1, from launchpad)

3/ select on customers tree view many records and print 'Partner List' (yes without configure jasper server connection)

Fail with:

2012-02-24 12:18:42,244 6201 ERROR ? openerp.service.web_services: Exception: 'NoneType' object has no attribute 'browse'
Traceback (most recent call last):
  File "/home/joseba/src/openerp_v61/openerp-server61/openerp/service/web_services.py", line 710, in go
    (result, format) = obj.create(cr, uid, ids, datas, context)
  File "/home/joseba/src/openerp_v61/otros_modulos/jasper_server/jasper.py", line 46, in create
    return Report(self.name, cr, uid, ids, data, context).execute()
  File "/home/joseba/src/openerp_v61/otros_modulos/jasper_server/report/report_soap.py", line 407, in execute
    (content, duplicate) = self._jasper_execute(ex, doc, js, pdf_list, ids, context=context)
  File "/home/joseba/src/openerp_v61/otros_modulos/jasper_server/report/report_soap.py", line 113, in _jasper_execute
    cur_obj = self.model_obj.browse(self.cr, self.uid, ex, context=context)
AttributeError: 'NoneType' object has no attribute 'browse'
2012-02-24 12:18:42,491 6201 ERROR ? openerp.netsvc: 'NoneType' object has no attribute 'browse'
(<type 'exceptions.AttributeError'>, AttributeError("'NoneType' object has no attribute 'browse'",), <traceback object at 0x69c87a0>)

Now, I configure jaser server name, ip, user, . . .

Same error with same procedure.

Thx Again.
 JuanjoA

Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Hi

Can you test the same procedure with the GTK Client ?

Regards,

Changed in openerp-jasperserver:
importance: Undecided → Low
assignee: nobody → Christophe Chauvet - http://www.syleam.fr/ (christophe-chauvet)
Revision history for this message
lambdasoftware (lambdasoftware) wrote :

Hi, thx for your help

On gtk client, the error change:

2012-02-27 11:05:28,958 17858 INFO jasper_server jasper_server: ====[REGISTER JASPER REPORT]========================
2012-02-27 11:05:28,959 17858 INFO jasper_server jasper_server: Register the jasper report service [jasper.partner_list]
2012-02-27 11:05:28,959 17858 INFO jasper_server jasper_server: ====[END REGISTER JASPER REPORT]====================
2012-02-27 11:05:41,145 17858 ERROR ? openerp.service.web_services: Exception: (u'Error', u'Code: 2\nMessage: /openerp/bases/jasper_server/PartnerList n\u2019est pas un rapport valide.')
Traceback (most recent call last):
  File "/home/joseba/src/openerp_v61/openerp-server61/openerp/service/web_services.py", line 710, in go
    (result, format) = obj.create(cr, uid, ids, datas, context)
  File "/home/joseba/src/openerp_v61/otros_modulos/jasper_server/jasper.py", line 48, in create
    raise except_osv(e.title, e.message)
except_osv: (u'Error', u'Code: 2\nMessage: /openerp/bases/jasper_server/PartnerList n\u2019est pas un rapport valide.')
2012-02-27 11:05:41,177 17858 ERROR ? openerp.netsvc: Error
Code: 2
Message: /openerp/bases/jasper_server/PartnerList n’est pas un rapport valide.

But now, my report work ok from gtk client. Only fail on web client

JuanjoA

Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Hi

Thanks, for the feedback, there is another bug report about problem with Web Client

It try to reproduce this problem

Regards,

Amit Parik (amit-parik)
Changed in openerp-web:
status: New → Triaged
Revision history for this message
Goran Cvijanović (goranc) wrote :

There is problem with call of browse method, and is definitely show stopper for web client reporting integration.

It is something with report_soap.py and line in method _jasper_execute:
cur_obj = self.model_obj.browse(self.cr, self.uid, ex, context=context)
error line: openerp.netsvc: 'NoneType' object has no attribute 'browse'
[model_obj is defined in __init__ as: self.model_obj = self.pool.get(self.model)]

Can anybody help with this ?

g.c.

Revision history for this message
Goran Cvijanović (goranc) wrote :

Here is a solution which solve problem with web client in OpenERP 6.1.
Module for jasper_server integration is working properly with GTK client,
because of different parameters passing to web_services.py server module.

data passed from GTK client is:
         dict: {'model': u'res.partner', 'id': 3, 'report_type': u'jasper'}
data passed from web client is:
         dict: {'report_type': u'jasper'}

To resolve ERROR ? openerp.netsvc: 'NoneType' object has no attribute 'browse'
we have to get model from database table 'ir.actions.report.xml' referencing with report_name.

Code change:
#
# addons/jasper_server/report/report_soap.py:
# in __init__ add after self.pool = pooler.get_pool(cr.dbname)
#
        if not self.model:
            pool = pooler.get_pool(cr.dbname)
            ir_obj = pool.get('ir.actions.report.xml')
            report_xml_ids = ir_obj.search(cr, uid, [('report_name', '=', self.name[7:])], context=context)
            if report_xml_ids:
                self.model = ir_obj.browse(cr, uid, report_xml_ids[0], context=context).model

I hope that Christophe Chauvet will include this in his branch or/and 6.6.1 branch (for 6.1)
For a problem with ir_set, ir_del and ir.values, the code is provided in bug report #983015.

So, after this corrections, the module is functional in OpenERP 6.1.
There is some old wizard type code, wizard for Make XML Template is not functional.
We can use jasper_report code for that, as it is functional under 6.1.

g.c.

Revision history for this message
Goran Cvijanović (goranc) wrote :

# Solution for web client - Omar (pexego) did it for jasper_reports module
# addons/jasper_server/report/report_soap.py:
# in __init__ change code to get model from data or active_model from context
self.model = data.get('model', False) or context.get('active_model', False)

g.c.

Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Hi

Thanks for your contribution (i don't have OpenERP 6.1 with jasper_server module in production)

Ok for the model, but i think it missed something for the ids (i must try)

I will look for the bug 983015 and fix _ir_set and ir_del

Regards,

Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

I have fix properly this issue, and don't use context to find the model (prevent from other bug in the future)

Regards,

Changed in openerp-jasperserver:
status: New → Fix Released
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Folks,

As per the whole conversion and also as per the traceback the problem was occurs due to jasper sever. And it 's already fixed.

Now this problem does not affecting on web architecture any more, So I am closing this issue for web.

Thanks!

Changed in openerp-web:
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.