This question has been flagged
2 Replies
4133 Views

Hi,

I have an error when launching custom report :

in report.xml

 

<report
            auto="False"
            id="facture"
            model="account.invoice"
            name="facture"
            rml="account_invoice_layout/report/account_print_invoice_fr.rml"
            string="Facture"
            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"/>

 

in report/account_print_invoice_fr.py

report_sxw.report_sxw('report.facture', 'account.invoice', 'addons/account_invoice_layout/report/account_print_invoice_fr.rml', parser=account_print_invoice_fr, header="internal")

when i run the report i have his error :

2014-11-05 22:56:24,165 2660 ERROR myDB openerp.service.web_services: Exception: u'report.facture'
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 711, in go
    obj = netsvc.LocalService('report.'+object)
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 98, in LocalService
    return Service._services[name]
KeyError: u'report.facture'
2014-11-05 22:56:24,414 2660 ERROR myDB openerp.netsvc: report.facture
(<type 'exceptions.KeyError'>, KeyError(u'report.facture',), <traceback object at 0xd137acc>)

my __init__.py contains :

import account_print_invoice_fr

any help ?

thanks a lot

Avatar
Discard
Best Answer

Hi,

report_sxw.report_sxw('report.facture', 'account.invoice', 'addons/account_invoice_layout/report/account_print_invoice_fr.rml', parser=account_print_invoice_fr, header="internal")

In this line you have to assign the class name in "parse" parameter. Can you confirm this ?

There may be the case that you have not given your report.xml into __openerp__.py file.

Is there any thing else then let us know. And give us the exact and entire trace log.

Avatar
Discard
Author Best Answer

Hi,

The class parser is 

class account_print_invoice_fr(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(account_print_invoice_fr, self).__init__(cr, uid, name, context=context)
        self.cr = cr
        self.uid = uid
        self.pool = pooler.get_pool(self.cr.dbname)
        self.localcontext.update({
            'time': time,
            'invoice_lines_layout': self._invoice_lines_layout,
        })
        self.context = context

The __openerp__.py file contains the reference to report.xml:

'data': [
        'account_invoice_layout_view.xml',
        'invoice_report.xml',
    ],

i see that the _init_.pyc in not generated in the report folder, can't be the sources of error ?

there is the log again :

2014-11-07 11:06:17,591 4325 INFO myDB werkzeug: 192.168.34.2 - - [07/Nov/2014 11:06:17] "POST /web/action/load HTTP/1.1" 200 -
2014-11-07 11:06:18,301 4325 ERROR myDB openerp.service.web_services: Exception: u'report.account_facture'
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 711, in go
    obj = netsvc.LocalService('report.'+object)
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 98, in LocalService
    return Service._services[name]
KeyError: u'report.account_facture'
2014-11-07 11:06:18,553 4325 ERROR myDB openerp.netsvc: report.account_facture
(<type 'exceptions.KeyError'>, KeyError(u'report.account_facture',), <traceback object at 0xb0fc194>)
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 296, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 654, in dispatch
    res = fn(db, uid, *params)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 760, in exp_report_get
    return self._check_report(report_id)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 738, in _check_report
    netsvc.abort_response(exc, exc.message, 'warning', exc.traceback)
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 71, in abort_response
    raise openerp.osv.osv.except_osv(description, details)
except_osv: (u'report.account_facture', (<type 'exceptions.KeyError'>, KeyError(u'report.account_facture',), <traceback object at 0xb0fc194>))
2014-11-07 11:06:18,559 4325 INFO myDB werkzeug: 192.168.34.2 - - [07/Nov/2014 11:06:18] "POST /web/report HTTP/1.1" 500 -
2014-11-07 11:06:18,615 4325 DEBUG ? openerp.service.cron: cron0 polling for jobs
2014-11-07 11:06:26,768 4325 DEBUG ? openerp.service.cron: cron1 polling for jobs

 

Avatar
Discard