I have received a module written for v7 that I wish to port to v8. There is a report written in RML that I supposed to work on v8 (RML is deprecated but still functional correct?) The report is declared as following:
<report
auto="False"
id="account.account_invoices"
model="account.invoice"
name="account.report_invoice_custom"
rml="recreate_customization/report/account_print_invoice.rml"
string="Invoices"
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
attachment_use="True"
usage="default"
/>
The parser:
import time
from openerp.report import report_sxw
class account_invoice(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_invoice, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
report_sxw.report_sxw(
'report.account.report_invoice_custom',
'account.invoice',
'recreate_customization/report/account_print_invoice.rml',
parser=account_invoice
)
My problem is that I get :
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi
execute(self.server.app)
File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/service/server.py", line 280, in app
return self.app(e, s)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/service/wsgi_server.py", line 216, in application
return application_unproxied(environ, start_response)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/service/wsgi_server.py", line 202, in application_unproxied
result = handler(environ, start_response)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 1214, in __call__
return self.dispatch(environ, start_response)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 1188, in __call__
return self.app(environ, start_wrapped)
File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 579, in __call__
return self.app(environ, start_response)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 1355, in dispatch
result = ir_http._dispatch()
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_http.py", line 130, in _dispatch
return self._handle_exception(e)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_http.py", line 100, in _handle_exception
return request._handle_exception(exception)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 595, in _handle_exception
return super(HttpRequest, self)._handle_exception(exception)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_http.py", line 126, in _dispatch
result = request.dispatch()
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 613, in dispatch
r = self._call_function(**self.params)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 282, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/service/model.py", line 113, in wrapper
return f(dbname, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 279, in checked_call
return self.endpoint(*a, **kw)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 732, in __call__
return self.method(*args, **kw)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 375, in response_wrap
response = f(*args, **kw)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 375, in response_wrap
response = f(*args, **kw)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/controllers/main.py", line 64, in report_routes
pdf = report_obj.get_pdf(cr, uid, docids, reportname, data=options_data, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/models/report.py", line 168, in get_pdf
html = self.get_html(cr, uid, ids, report_name, data=data, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/models/report.py", line 153, in get_html
return self.render(cr, uid, [], report.report_name, docargs, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/models/report.py", line 129, in render
return view_obj.render(cr, uid, template, values, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_ui_view.py", line 1007, in render
return self.pool[engine].render(cr, uid, id_or_xml_id, qcontext, loader=loader, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_qweb.py", line 247, in render
return self.render_node(self.get_template(id_or_xml_id, qwebcontext), qwebcontext)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_qweb.py", line 187, in get_template
raise_qweb_exception(QWebTemplateNotFound, message="Loader could not find template %r" % name, template=origin_template)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_qweb.py", line 185, in get_template
xml_doc = qwebcontext.loader(name)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_ui_view.py", line 1005, in loader
return self.read_template(cr, uid, name, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "<string>", line 2, in read_template
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/tools/cache.py", line 119, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_ui_view.py", line 849, in read_template
view_id = self.pool['ir.model.data'].xmlid_to_res_id(cr, uid, xml_id, raise_if_not_found=True)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_model.py", line 925, in xmlid_to_res_id
return self.xmlid_to_res_model_res_id(cr, uid, xmlid, raise_if_not_found)[1]
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_model.py", line 917, in xmlid_to_res_model_res_id
return self.xmlid_lookup(cr, uid, xmlid)[1:3]
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "<string>", line 2, in xmlid_lookup
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/tools/cache.py", line 71, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_model.py", line 907, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % (xmlid))
QWebTemplateNotFound: External ID not found in the system: account.report_invoice_custom
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/controllers/main.py", line 117, in report_download
response = self.report_routes(reportname, docids=docids, converter='pdf')
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 375, in response_wrap
response = f(*args, **kw)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/controllers/main.py", line 64, in report_routes
pdf = report_obj.get_pdf(cr, uid, docids, reportname, data=options_data, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/models/report.py", line 168, in get_pdf
html = self.get_html(cr, uid, ids, report_name, data=data, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/models/report.py", line 153, in get_html
return self.render(cr, uid, [], report.report_name, docargs, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/models/report.py", line 129, in render
return view_obj.render(cr, uid, template, values, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_ui_view.py", line 1007, in render
return self.pool[engine].render(cr, uid, id_or_xml_id, qcontext, loader=loader, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_qweb.py", line 247, in render
return self.render_node(self.get_template(id_or_xml_id, qwebcontext), qwebcontext)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_qweb.py", line 187, in get_template
raise_qweb_exception(QWebTemplateNotFound, message="Loader could not find template %r" % name, template=origin_template)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_qweb.py", line 185, in get_template
xml_doc = qwebcontext.loader(name)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_ui_view.py", line 1005, in loader
return self.read_template(cr, uid, name, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "<string>", line 2, in read_template
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/tools/cache.py", line 119, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_ui_view.py", line 849, in read_template
view_id = self.pool['ir.model.data'].xmlid_to_res_id(cr, uid, xml_id, raise_if_not_found=True)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_model.py", line 925, in xmlid_to_res_id
return self.xmlid_to_res_model_res_id(cr, uid, xmlid, raise_if_not_found)[1]
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_model.py", line 917, in xmlid_to_res_model_res_id
return self.xmlid_lookup(cr, uid, xmlid)[1:3]
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "<string>", line 2, in xmlid_lookup
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/tools/cache.py", line 71, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_model.py", line 907, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % (xmlid))
QWebTemplateNotFound: External ID not found in the system: account.report_invoice_custom
You used account.report_invoice_custom
as a report name
, you need to change without specifying a module name and id
must be unique.
<report
auto="False"
id="account.account_invoices"
model="account.invoice"
name="report_invoice_custom"
rml="recreate_customization/report/account_print_invoice.rml"
string="Invoices"
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
attachment_use="True"
usage="default"
/>
Parser:
import time
from openerp.report import report_sxw
class account_invoice(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_invoice, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
report_sxw.report_sxw(
'report.report_invoice_custom',
'account.invoice',
'addons/recreate_customization/report/account_print_invoice.rml',
parser=account_invoice
)