[6.1 + webclient] keyerror 'model' while generating report

Bug #910759 reported by Gautam on 2012-01-02
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Aeroo Reports
sraps (Alistek)

Bug Description


I downloaded the latest trunk version of openerp and the aeroo reports 6.1.x RC6. After installing the aeroo_report and aeroo_report_sameple modules I get the following error while trying to print a report:

ERROR:web-services:[02]: Environment Information :
ERROR:web-services:[03]: System : Linux-2.6.32-37-server-x86_64-with-Ubuntu-10.04-lucid
ERROR:web-services:[04]: OS Name : posix
ERROR:web-services:[05]: Distributor ID: Ubuntu
ERROR:web-services:[06]: Description: Ubuntu 10.04.3 LTS
ERROR:web-services:[07]: Release: 10.04
ERROR:web-services:[08]: Codename: lucid
ERROR:web-services:[09]: Operating System Release : 2.6.32-37-server
ERROR:web-services:[10]: Operating System Version : #81-Ubuntu SMP Fri Dec 2 20:49:12 UTC 2011
ERROR:web-services:[11]: Operating System Architecture : 64bit
ERROR:web-services:[12]: Operating System Locale : en_US.UTF8
ERROR:web-services:[13]: Python Version : 2.6.5
ERROR:web-services:[14]: OpenERP-Server Version : 6.1beta
ERROR:web-services:[15]: Exception: 'model'
ERROR:web-services:[16]: Traceback (most recent call last):
ERROR:web-services:[17]: File "/home/openerp/projects/openERP/development/latest/openobject-server/openerp/service/web_services.py", line 725, in go
ERROR:web-services:[18]: (result, format) = obj.create(cr, uid, ids, datas, context)
ERROR:web-services:[19]: File "/home/openerp/bazaar/trunk/extra-addons/report_aeroo/report_aeroo.py", line 679, in create
ERROR:web-services:[20]: return fnct(cr, uid, ids, data, report_xml, context)
ERROR:web-services:[21]: File "/home/openerp/bazaar/trunk/extra-addons/report_aeroo/report_aeroo.py", line 625, in create_source_odt
ERROR:web-services:[22]: return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
ERROR:web-services:[23]: File "/home/openerp/bazaar/trunk/extra-addons/report_aeroo/report_aeroo.py", line 472, in create_single_pdf
ERROR:web-services:[24]: return self.create_aeroo_report(cr, uid, ids, data, report_xml, context=context, output=output)
ERROR:web-services:[25]: File "/home/openerp/bazaar/trunk/extra-addons/report_aeroo/report_aeroo.py", line 406, in create_aeroo_report
ERROR:web-services:[26]: model_id = pool.get('ir.model').search(cr, uid, [('model','=',data['model'])])[0]
ERROR:web-services:[27]: KeyError: 'model'
INFO:werkzeug: - - [02/Jan/2012 08:45:32] "POST /web/report HTTP/1.1" 500 -
ERROR:werkzeug:Error on request:
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Werkzeug-0.8.1-py2.6.egg/werkzeug/serving.py", line 159, in run_wsgi
  File "/usr/local/lib/python2.6/dist-packages/Werkzeug-0.8.1-py2.6.egg/werkzeug/serving.py", line 146, in execute
    application_iter = app(environ, start_response)
  File "/home/openerp/projects/openERP/development/latest/openobject-server/openerp/wsgi.py", line 398, in application
    result = handler(environ, start_response)
  File "/home/openerp/projects/openERP/development/latest/openerp-web/addons/web/common/http.py", line 434, in __call__
    return self.dispatch(environ, start_response)
  File "/usr/local/lib/python2.6/dist-packages/Werkzeug-0.8.1-py2.6.egg/werkzeug/wsgi.py", line 411, in __call__
    return self.app(environ, start_response)
  File "/home/openerp/projects/openERP/development/latest/openerp-web/addons/web/common/http.py", line 470, in dispatch
    response.set_cookie(self.session_cookie, session.sid)
  File "/usr/lib/python2.6/contextlib.py", line 34, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/openerp/projects/openERP/development/latest/openerp-web/addons/web/common/http.py", line 325, in session_context
    yield request.session
  File "/home/openerp/projects/openERP/development/latest/openerp-web/addons/web/common/http.py", line 461, in dispatch
    result = handler( request, self.config)
  File "/home/openerp/projects/openERP/development/latest/openerp-web/addons/web/common/http.py", line 299, in http_handler
    return HttpRequest(request, config).dispatch(controller, f)
  File "/home/openerp/projects/openERP/development/latest/openerp-web/addons/web/common/http.py", line 254, in dispatch
    r = method(controller, self, **self.params)
  File "/home/openerp/projects/openERP/development/latest/openerp-web/addons/web/controllers/main.py", line 1565, in index
    req.session._db, req.session._uid, req.session._password, report_id)
  File "/home/openerp/projects/openERP/development/latest/openerp-web/addons/web/common/openerplib/main.py", line 306, in proxy
    result = self.connector.send(self.service_name, method, *args)
  File "/home/openerp/projects/openERP/development/latest/openerp-web/addons/web/common/openerplib/main.py", line 261, in send
    fault = xmlrpclib.Fault('warning -- ' + e.name + '\n\n' + e.value, '')
TypeError: coercing to Unicode: need string or buffer, tuple found

I don't get this error when I print the report from the "test report" button in the Customization->Aeroo Reports->Reports
Is there anything I need to configure?


Related branches

Gautam (gditerp) on 2012-01-02
description: updated


you beat me to posting this ;-)

The 6.1 web client does not add the model to the 'data' argument when generating the report.

[2012-01-02 10:47:54,104][?] DEBUG_RPC:service:report.report('dev61domain',
[2012-01-02 10:47:54,104][?] DEBUG_RPC:service: 1,
[2012-01-02 10:47:54,104][?] DEBUG_RPC:service: '*',
[2012-01-02 10:47:54,104][?] DEBUG_RPC:service: u'fdsa',
[2012-01-02 10:47:54,104][?] DEBUG_RPC:service: [1],
[2012-01-02 10:47:54,104][?] DEBUG_RPC:service: {'report_type': u'aeroo'},
[2012-01-02 10:47:54,104][?] DEBUG_RPC:service: {u'active_id': 1,
[2012-01-02 10:47:54,104][?] DEBUG_RPC:service: u'active_ids': [1],
[2012-01-02 10:47:54,104][?] DEBUG_RPC:service: u'active_model': u'res.partner',
[2012-01-02 10:47:54,105][?] DEBUG_RPC:service: 'lang': u'en_US',
[2012-01-02 10:47:54,105][?] DEBUG_RPC:service: 'tz': False})

Instead, the model can be taken from context['active_model'].


summary: - keyerror while generating report
+ [6.1 + webclient] keyerror 'model while generating report
summary: - [6.1 + webclient] keyerror 'model while generating report
+ [6.1 + webclient] keyerror 'model' while generating report
Gautam (gditerp) wrote :

Hi Stefan,

Thanks for the patch, will test it now.


Viktor Vorobjov (vicom) wrote :

I for test in report_aeroo.py in line:406
put id for example =85
 - model_id = pool.get('ir.model').search(cr, uid, [('model','=',data['model'])])[0]
 + model_id = '85'
now work and generate pdf.

after a test information from Stefan Rijnhart. change data['model'] to context['active_model']

 - model_id = pool.get('ir.model').search(cr, uid, [('model','=',data['model'])])[0]
+ model_id = pool.get('ir.model').search(cr, uid, [('model','=',context['active_model'])])[0]

Now pdf generate fine.

Stefan: +1

I try this:

        #model_id = pool.get('ir.model').search(cr, uid, [('model','=',data['model'])])[0]
        model_id = pool.get('ir.model').search(cr, uid, [('model','=',context['active_model'])])[0]

and works fine.

Alan Lord (theopensourcerer) wrote :

@Angel's fix above seems to work.

I had reports working from the GTK but not from the Web. Applying Angel's change to line ~405 seems to fix that issue.

Changed in aeroo:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → sraps (Alistek) (erpsraps)
Changed in aeroo:
status: Confirmed → Fix Released

I think that this breaks the installation of Aeroo Reports on a OpenERP 6.0.3
I have installed Aeroo Reports on a OpenERP 6.0.3 system and it works from the GTK client but gives the following error from the Web Client:

(<type 'exceptions.KeyError'>, KeyError('active_model',), <traceback object at 0x59c4440>)

I see in the report_aeroo.py that the above fix is in the code and is using "active_model".

I have changed it, but I don't know how to re-install Aeroo so that the manually changed code takes effect. I tried "python ./setup.py install" but it just tells me it is already installed, I tried "python ./setup.py install --force" without success either. Any ideas how to re-install?

sraps (Alistek) (erpsraps) wrote :

Use unzip'ed version of Aeroo, and after the code change do restart the OpenERP service. No upgrade of module needed in OpenERP system, just do a restart, for this change to take effect.

Rose Anne Carpeso (roseanne) wrote :


I checked the code for on the said line and it is fixed already.
But still, I could not generate a PDF report using the GTK and the web client.
Also, ODT reports on web still don't work.
But using the GTK, ODT and ODS seems to work fine.

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

Other bug subscribers