Skip to Content
Menu
This question has been flagged
3 Replies
29875 Views

Hello,

I want to create a report that is installable with a custom module I get the following error when I try to print the report.

I created it using the base_report_designer and openoffice. The copy that I uploaded to the server works fine but when I try to run the rml version which I installed using my custom module, i get the following error.

2013-05-03 05:12:01,705 25469 ERROR testDB openerp.service.web_services: Exception: u'report.faxing.fax'
Traceback (most recent call last):
  File "/opt/openerp/server/openerp/service/web_services.py", line 711, in go
    obj = netsvc.LocalService('report.'+object)
  File "/opt/openerp/server/openerp/netsvc.py", line 99, in LocalService
    return Service._services[name]
KeyError: u'report.faxing.fax'
2013-05-03 05:12:01,955 25469 ERROR testDB openerp.netsvc: report.faxing.fax
(<type 'exceptions.KeyError'>, KeyError(u'report.faxing.fax',), <traceback object at 0xb271d20c>)
Traceback (most recent call last):
  File "/opt/openerp/server/openerp/netsvc.py", line 293, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/opt/openerp/server/openerp/service/web_services.py", line 654, in dispatch
    res = fn(db, uid, *params)
  File "/opt/openerp/server/openerp/service/web_services.py", line 760, in exp_report_get
    return self._check_report(report_id)
  File "/opt/openerp/server/openerp/service/web_services.py", line 738, in _check_report
    netsvc.abort_response(exc, exc.message, 'warning', exc.traceback)
  File "/opt/openerp/server/openerp/netsvc.py", line 72, in abort_response
    raise openerp.osv.osv.except_osv(description, details)
except_osv: (u'report.faxing.fax', (<type 'exceptions.KeyError'>, KeyError(u'report.faxing.fax',), <traceback object at 0xb271d20c>))

here is the python code adding the report

import time
from openerp.report import report_sxw

class faxing_attach_cover(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(faxing_attach_cover, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
        })
report_sxw.report_sxw(
    'report.faxing.fax',
    'faxing.fax',
    'base_report_to_fax/report/fax_report.rml',
    parser=faxing_attach_cover,
    header="external"
)

here is the XML i use to add the report to the server.

<openerp>
    <data>
        <report
            auto="False"
            id="faxing_faxs"
            model="faxing.fax"
            name="faxing.fax"
            rml="base_report_to_fax/report/fax_report.rml"
            string="Fax Coverpage"
            attachment="(object.state in ('pending')) and ('INV'+(object.name or '').replace('/','')+'.pdf')"
            attachment_use="True"
            usage="default"
            />
    </data>
</openerp>

What am i doing wrong?

Avatar
Discard
Best Answer

maybe u just forgot import the report folder in the __init__.py at the root folder of module. i got the silly problem and took me about 2hours to find it.......

Avatar
Discard
Author

yes that was it, i forgot to import the report in _init_.py

Best Answer

Your Error says that give 'name' is wrong in report_sxw.report_sxw('report.faxing.fax', ( PY ) which must be started with report. +(object).

Avatar
Discard
Best Answer

please do following changes in your report.py

replace following code:

report_sxw.report_sxw(
    'report.faxing.fax',
    'faxing.fax',
    'base_report_to_fax/report/fax_report.rml',
    parser=faxing_attach_cover,
    header="external"
)

with

report_sxw.report_sxw(
    'report.faxing_faxs',
    'faxing.fax',
    'base_report_to_fax/report/fax_report.rml',
    parser=faxing_attach_cover,
    header="external"
)
Avatar
Discard
Related Posts Replies Views Activity
1
Jan 24
3513
3
Oct 18
5551
1
Mar 15
8487
0
Mar 15
3688
2
Feb 24
11512