If any osv_exeption raised from Report Services then it gives a error cause warning type is comes as a tuple instead of str

Bug #941124 reported by Marek
32
This bug affects 6 people
Affects Status Importance Assigned to Milestone
JasperReport Server Connector
Invalid
Undecided
Unassigned
Odoo Web (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Web Team

Bug Description

Hi,

when trying to print from Web Client (6.1), following error appears (but works from GTK client):

Client Traceback (most recent call last):
  File "C:\Program Files (x86)\OpenERP 6.1-1\server\openerp\addons\web\common\http.py", line 260, in dispatch
  File "C:\Program Files (x86)\OpenERP 6.1-1\server\openerp\addons\web\controllers\main.py", line 1784, in index
  File "C:\Program Files (x86)\OpenERP 6.1-1\server\openerp\addons\web\common\openerplib\main.py", line 117, in proxy
  File "C:\Program Files (x86)\OpenERP 6.1-1\server\openerp\addons\web\common\http.py", line 596, in send
TypeError: coercing to Unicode: need string or buffer, tuple found

Thanks

Related branches

Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

Well, the only thing I can tell from this traceback is that the web client gets an error it can't translate, the code blowing up is:

    if isinstance(e, openerp.osv.osv.except_osv):
        fault = xmlrpclib.Fault('warning -- ' + e.name + '\n\n' + e.value, '')

so either e.name or e.value is a tuple (instead of a str or unicode object) in the except_osv exception. But we've little more in the way of sources, we'd need some more reproduction information (such as the steps which led you to this error). You might also have a more interesting traceback in the server logs.

Changed in openerp-web:
status: New → Incomplete
Revision history for this message
Marek (christenh) wrote :

Hi,

this is the latest traceback from server log. I´ve created a report, which can be processed either from iReport and from Jasper Server repository.

Thanks for assistance,

Traceback (most recent call last):
  File "C:\Program Files (x86)\OpenERP 6.1-1\server\.\openerp\service\web_services.py", line 710, in go
  File "C:\Program Files (x86)\OpenERP 6.1-1\server\openerp\addons\jasper_server\report\jasper.py", line 44, in create
  File "C:\Program Files (x86)\OpenERP 6.1-1\server\openerp\addons\jasper_server\report\report_soap.py", line 405, in execute
  File "C:\Program Files (x86)\OpenERP 6.1-1\server\openerp\addons\jasper_server\report\report_soap.py", line 113, in _jasper_execute
AttributeError: 'NoneType' object has no attribute 'browse'
2012-02-28 17:03:13,052 39036 ERROR ? openerp.netsvc: 'NoneType' object has no attribute 'browse'
(<type 'exceptions.AttributeError'>, AttributeError("'NoneType' object has no attribute 'browse'",), <traceback object at 0x0424FC88>)
2012-02-28 17:03:13,052 39036 ERROR ? openerp.addons.web.common.http.HttpRequest.dispatch: An error occurred while handling a json request
Traceback (most recent call last):
  File "C:\Program Files (x86)\OpenERP 6.1-1\server\openerp\addons\web\common\http.py", line 260, in dispatch
  File "C:\Program Files (x86)\OpenERP 6.1-1\server\openerp\addons\web\controllers\main.py", line 1784, in index
  File "C:\Program Files (x86)\OpenERP 6.1-1\server\openerp\addons\web\common\openerplib\main.py", line 117, in proxy
  File "C:\Program Files (x86)\OpenERP 6.1-1\server\openerp\addons\web\common\http.py", line 596, in send
TypeError: coercing to Unicode: need string or buffer, tuple found
2012-02-28 17:03:13,117 39036 INFO ? werkzeug: 127.0.0.1 - - [28/Feb/2012 17:03:13] "POST /web/report HTTP/1.1" 500 -

Revision history for this message
Elvin Kosova (elvinkosova) wrote :

I've got the same error when I've tried to use "WebKit invoice" Print Button from an invoice provided by "report_webkit_sample" module. I am using OpenERP 6.1.

Cheers.

Revision history for this message
Elvin Kosova (elvinkosova) wrote :

Just to add that I explicitly use Web Client, and my error confirmation in comment #3 comes from Web Client. I have not tried reproducing the error using GTK client. My OpenERP installation is running on Xubuntu 11.10., installed from the .deb package downloaded from OpenERP web site. Here is the error:

Client Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/http.py", line 260, in dispatch
    r = method(controller, self, **self.params)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 1784, in index
    req.session._db, req.session._uid, req.session._password, report_id)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/openerplib/main.py", line 117, in proxy
    result = self.connector.send(self.service_name, method, *args)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/http.py", line 596, in send
    fault = xmlrpclib.Fault('warning -- ' + e.name + '\n\n' + e.value, '')
TypeError: coercing to Unicode: need string or buffer, tuple found

I have also attached screenshot of the error.

Cheers.

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Elvin,

report webkit problem is already posted on lp:942679 (which is also producible in GTK ), would you please look in to lp:942679.

So your issue doesn't related with reported bug because this issue is only for web with jasper report.

Hope this will help you.

Cheers.

Revision history for this message
Alan Lord (theopensourcerer) wrote :

I'm seeing this exact same error occurring with Aeroo reports too.

Webkit, Jasper and Aeroo??? Something amiss somewhere me thinks...

Revision history for this message
Elvin Kosova (elvinkosova) wrote :

Amit,

Thanks for the bug reference.

Cheers.

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Folks,

First of all sorry for the inconvenience!

This is the clear cut bug of the web client when report service called a osv.osv_exception then this type of error is faced on web client.

XMO is absolutely right on his comment#1, at the time of the osv_exception (warning) e.value is a tuple instead of str (via report services). And for another point for unicode issue are already fixed on server branch please look in lp:956798.

Also this is not jasper server's error that's why I am closing it for jasper server (jasper server error was fixed on lp:934068).
That's why I am assigning this for the web client.

Solution: we have just change type casting of e.value on http.py line no 596 like str(e.value).

Thanks for understanding!

Revision history for this message
Amit Parik (amit-parik) wrote :

As Xavier wants a producible steps then in two different way I have faced this error.

1)Install hr_recruitment module, Open the applicant(application) form view. You can see the interview button try to print it without survey_id (under job_id field), it gives a this error (because in this case It 's raised a programming error and we have passed this error as a exception.

Note: we have put a attrs on interview button, it will displayed only when record have survey_id but it's another web client error please see lp:985005.

2) Install account_analytic_plan module. Create one analytic entry for one analytic account, go to analytic account and select this account and try to print a "Crossovered Analytic" report. This error is generated.

I think this both scenario help for reproduce the bug.

Thanks!

summary: - Unable to print jasper report from web client, but works in GTK
+ If any osv_exeption raised from Report Services then it gives a error
+ cause warning type is comes as a tuple instead of str
Changed in openerp-jasperserver:
status: New → Invalid
Changed in openerp-web:
assignee: nobody → OpenERP R&D Web Team (openerp-dev-web)
importance: Undecided → Medium
status: Incomplete → Confirmed
Amit Parik (amit-parik)
Changed in openerp-web:
status: Confirmed → In Progress
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Marek,

Thanks for the reporting!

This issue has been fixed on lp:~openerp-dev/openerp-web/trunk-bug-941124-amp branch with following rev no and rev Id.

rev no : 2488
rev Id : <email address hidden>

It will be merge with trunk soon.

Thanks!

Changed in openerp-web:
status: In Progress → Fix Committed
Changed in openerp-web:
status: Fix Committed → Fix Released
Revision history for this message
Joshua Jan(SHINEIT) (joshuajan) wrote :

Hello
        I found another problem when I try this patch.
        when the e.value`s type is tuple ,It`s ok str(e.value).
        But when the e.value`s type is unicode(Eg. Chinese), It will error.
Thank you.
Joshua

Revision history for this message
Joshua Jan(SHINEIT) (joshuajan) wrote :

Hello all,
   I think this is better for unicode character
Best Regards
Joshua

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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