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

Hello,
I am trying to print a report for example [products barcode (PDF)] but i have 'barcode' word intead of the image for the barcode in the pdf.

when i try http://localhost:8069/report/barcode/Code128/test-0001 'or' http://localhost:8069/report/barcode/?type=Code128&value=ABC1234&width=600&height=150, I got the below error

Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.  
Any help ?
Avatar
Discard
Author

using Odoo 13

Author

this is what i receive into log file of Odoo

2020-05-28 22:08:25,996 2806 INFO SuperOdoo werkzeug: 156.215.204.187 - - [28/May/2020 22:08:25] "GET /report/barcode/Code128/test-0001 HTTP/1.1" 500 - 1 0.000 0.00

7

2020-05-28 22:08:26,004 2806 ERROR SuperOdoo werkzeug: Error on request:

Traceback (most recent call last):

File "/usr/lib/python3/dist-packages/reportlab/graphics/renderPM.py", line 242, in _setFont

gs.setFont(fontName,fontSize)

ValueError: _renderPM.gstate_setFont: Can't find font!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/usr/lib/python3/dist-packages/reportlab/graphics/renderPM.py", line 248, in _setFont

_renderPM.makeT1Font(fontName,f.face.findT1File(),f.encoding.vector,open_and_read)

TypeError: makeT1Font() argument 2 must be str, not None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 306, in run_wsgi

execute(self.server.app)

File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 294, in execute

application_iter = app(environ, start_response)

File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 439, in app

return self.app(e, s)

File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 142, in application

return application_unproxied(environ, start_response)

File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 117, in application_unproxied

result = odoo.http.root(environ, start_response)

File "/usr/lib/python3/dist-packages/odoo/http.py", line 1287, in __call__

return self.dispatch(environ, start_response)

File "/usr/lib/python3/dist-packages/odoo/http.py", line 1257, in __call__

return self.app(environ, start_wrapped)

File "/usr/lib/python3/dist-packages/werkzeug/middleware/shared_data.py", line 220, in __call__

return self.app(environ, start_response)

File "/usr/lib/python3/dist-packages/odoo/http.py", line 1457, in dispatch

result = ir_http._dispatch()

File "/usr/lib/python3/dist-packages/odoo/addons/website_sale/models/ir_http.py", line 15, in _dispatch

return super(IrHttp, cls)._dispatch()

File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_http.py", line 172, in _dispatch

response = super(Http, cls)._dispatch()

File "/usr/lib/python3/dist-packages/odoo/addons/auth_signup/models/ir_http.py", line 19, in _dispatch

return super(Http, cls)._dispatch()

File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_http.py", line 21, in _dispatch

return super(IrHttp, cls)._dispatch()

File "/usr/lib/python3/dist-packages/odoo/addons/utm/models/ir_http.py", line 29, in _dispatch

response = super(IrHttp, cls)._dispatch()

File "/usr/lib/python3/dist-packages/odoo/addons/http_routing/models/ir_http.py", line 519, in _dispatch

result = super(IrHttp, cls)._dispatch()

File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 233, in _dispatch

return cls._handle_exception(e)

File "/usr/lib/python3/dist-packages/odoo/addons/utm/models/ir_http.py", line 34, in _handle_exception

response = super(IrHttp, cls)._handle_exception(exc)

File "/usr/lib/python3/dist-packages/odoo/addons/http_routing/models/ir_http.py", line 610, in _handle_exception

return super(IrHttp, cls)._handle_exception(exception)

File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 201, in _handle_exception

return request._handle_exception(exception)

File "/usr/lib/python3/dist-packages/odoo/http.py", line 750, in _handle_exception

return super(HttpRequest, self)._handle_exception(exception)

File "/usr/lib/python3/dist-packages/odoo/http.py", line 310, in _handle_exception

raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])

File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 14, in reraise

raise value

File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 229, in _dispatch

result = request.dispatch()

File "/usr/lib/python3/dist-packages/odoo/http.py", line 809, in dispatch

r = self._call_function(**self.params)

File "/usr/lib/python3/dist-packages/odoo/http.py", line 350, in _call_function

return checked_call(self.db, *args, **kwargs)

File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper

return f(dbname, *args, **kwargs)

File "/usr/lib/python3/dist-packages/odoo/http.py", line 339, in checked_call

result = self.endpoint(*a, **kw)

File "/usr/lib/python3/dist-packages/odoo/http.py", line 915, in __call__

return self.method(*args, **kw)

File "/usr/lib/python3/dist-packages/odoo/http.py", line 515, in response_wrap

response = f(*args, **kw)

File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1991, in report_barcode

barcode = request.env['ir.actions.report'].barcode(type, value, width=width,

File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 506, in barcode

return barcode.asString('png')

File "/usr/lib/python3/dist-packages/reportlab/graphics/shapes.py", line 854, in asString

return renderPM.drawToString(self, fmt=format,showBoundary=getattr(self,'showBorder',

File "/usr/lib/python3/dist-packages/reportlab/graphics/renderPM.py", line 685, in drawToString

drawToFile(d,s,fmt=fmt, dpi=dpi, bg=bg, configPIL=configPIL)

File "/usr/lib/python3/dist-packages/reportlab/graphics/renderPM.py", line 680, in drawToFile

c = drawToPMCanvas(d, dpi=dpi, bg=bg, configPIL=configPIL, showBoundary=showBoundary)

File "/usr/lib/python3/dist-packages/reportlab/graphics/renderPM.py", line 666, in drawToPMCanvas

draw(d, c, 0, 0, showBoundary=showBoundary)

File "/usr/lib/python3/dist-packages/reportlab/graphics/renderPM.py", line 51, in draw

R.draw(renderScaledDrawing(drawing), canvas, x, y, showBoundary=showBoundary)

File "/usr/lib/python3/dist-packages/reportlab/graphics/renderbase.py", line 204, in draw

self.initState(x,y) #this is the push()

File "/usr/lib/python3/dist-packages/reportlab/graphics/renderPM.py", line 98, in initState

self.applyState()

File "/usr/lib/python3/dist-packages/reportlab/graphics/renderPM.py", line 92, in applyState

self._canvas.setFont(s['fontName'], s['fontSize'])

File "/usr/lib/python3/dist-packages/reportlab/graphics/renderPM.py", line 399, in setFont

_setFont(self._gs,fontName,fontSize)

File "/usr/lib/python3/dist-packages/reportlab/graphics/renderPM.py", line 251, in _setFont

raise RenderPMError("Can't setFont(%s) missing the T1 files?\nOriginally %s: %s" % (fontName,s1,s2))

reportlab.graphics.renderPM.RenderPMError: Can't setFont(Times-Roman) missing the T1 files?

Author Best Answer

Problem solved after upgrade the reportlab using 

sudo pip3 install reportlab --upgrade 

reportlab upgraded from version 3.5.34 to 3.5.42
using odoo 13 CE on Ubuntu 20.04 LTS

Avatar
Discard