Odoo Help

0

Error in custom report ?

By
CHEBBAKI kader
on 11/5/14, 5:57 PM 1,216 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

0

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.

0
CHEBBAKI kader
On 11/7/14, 6:09 AM

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

 

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 11/5/14, 5:57 PM
Seen: 1216 times
Last updated: 3/16/15, 8:10 AM