You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a related image field to product.supplierinfo (we_product_tmpl_image = fields.Image(related='product_tmpl_id.image_256'))
Show that image in the supplier form view: (<field name="we_product_tmpl_image" widget="image" />)
Try to open form view
Current behavior:
Image wont load, because product.supplierinfo.name is a many2one:
2022-05-18 10:14:39,874 4276 INFO odoo werkzeug: 10.1.0.1 - - [18/May/2022 10:14:39] "GET /web/image?model=product.supplierinfo&id=986&field=product_tmpl_image&unique=16052022104745 HTTP/1.1" 500 - 11 0.007 0.012
2022-05-18 10:14:39,888 4276 ERROR odoo werkzeug: Error on request:
Traceback (most recent call last):
File "/odoo/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/odoo/odoo/odoo/http.py", line 806, in dispatch
r = self._call_function(**self.params)
File "/odoo/odoo/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/odoo/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/odoo/odoo/odoo/http.py", line 347, in checked_call
result = self.endpoint(*a, **kw)
File "/odoo/odoo/odoo/http.py", line 912, in __call__
return self.method(*args, **kw)
File "/odoo/odoo/odoo/http.py", line 531, in response_wrap
response = f(*args, **kw)
File "/odoo/odoo/addons/web/controllers/main.py", line 1508, in content_image
return self._content_image(xmlid=xmlid, model=model, id=id, field=field,
File "/odoo/odoo/addons/web/controllers/main.py", line 1517, in _content_image
status, headers, image_base64 = request.env['ir.http'].binary_content(
File "/odoo/odoo/odoo/addons/base/models/ir_http.py", line 473, in binary_content
status, content, filename, mimetype, filehash = self._binary_record_content(
File "/odoo/odoo/odoo/addons/base/models/ir_http.py", line 410, in _binary_record_content
has_extension = bool(mimetypes.guess_type(filename)[0])
File "/usr/local/lib/python3.8/mimetypes.py", line 292, in guess_type
return _db.guess_type(url, strict)
File "/usr/local/lib/python3.8/mimetypes.py", line 116, in guess_type
url = os.fspath(url)
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/odoo/.local/lib/python3.8/site-packages/werkzeug/serving.py", line 306, in run_wsgi
execute(self.server.app)
File "/home/odoo/.local/lib/python3.8/site-packages/werkzeug/serving.py", line 294, in execute
application_iter = app(environ, start_response)
File "/odoo/odoo/odoo/service/wsgi_server.py", line 111, in application
return ProxyFix(application_unproxied)(environ, start_response)
File "/home/odoo/.local/lib/python3.8/site-packages/werkzeug/middleware/proxy_fix.py", line 232, in __call__
return self.app(environ, start_response)
File "/odoo/odoo/odoo/service/wsgi_server.py", line 88, in application_unproxied
result = odoo.http.root(environ, start_response)
File "/odoo/odoo/odoo/http.py", line 1328, in __call__
return self.dispatch(environ, start_response)
File "/odoo/odoo/odoo/http.py", line 1294, in __call__
return self.app(environ, start_wrapped)
File "/home/odoo/.local/lib/python3.8/site-packages/werkzeug/middleware/shared_data.py", line 220, in __call__
return self.app(environ, start_response)
File "/odoo/odoo/odoo/http.py", line 1518, in dispatch
result = ir_http._dispatch()
File "/odoo/odoo/addons/auth_signup/models/ir_http.py", line 19, in _dispatch
return super(Http, cls)._dispatch()
File "/odoo/odoo/addons/web_editor/models/ir_http.py", line 21, in _dispatch
return super(IrHttp, cls)._dispatch()
File "/odoo/odoo/addons/utm/models/ir_http.py", line 29, in _dispatch
response = super(IrHttp, cls)._dispatch()
File "/odoo/odoo/addons/http_routing/models/ir_http.py", line 508, in _dispatch
result = super(IrHttp, cls)._dispatch()
File "/odoo/odoo/odoo/addons/base/models/ir_http.py", line 241, in _dispatch
return cls._handle_exception(e)
File "/odoo/odoo/addons/utm/models/ir_http.py", line 34, in _handle_exception
response = super(IrHttp, cls)._handle_exception(exc)
File "/odoo/odoo/addons/http_routing/models/ir_http.py", line 598, in _handle_exception
return super(IrHttp, cls)._handle_exception(exception)
File "/odoo/odoo/odoo/addons/base/models/ir_http.py", line 209, in _handle_exception
return request._handle_exception(exception)
File "/odoo/odoo/odoo/http.py", line 744, in _handle_exception
return super(HttpRequest, self)._handle_exception(exception)
File "/odoo/odoo/odoo/http.py", line 315, in _handle_exception
raise exception.with_traceback(None) from new_cause
TypeError: expected str, bytes or os.PathLike object, not res.partner - - -
Expected behavior:
Image should load without error.
Maybe there should be a check, wether the filename is a record, and if yes, fall back to display_name?
Or make filename_field configurable via an XML attribute on the widget.
The text was updated successfully, but these errors were encountered:
joshkreud
changed the title
[14.0] Image Widget when name is many2x type (e.g. product.supplierinfo)
[14.0] Image Widget not loading when name is many2x type (e.g. product.supplierinfo)
May 18, 2022
joshkreud
changed the title
[14.0] Image Widget not loading when name is many2x type (e.g. product.supplierinfo)
[14.0] Image Widget not loading when record.name is many2x type (e.g. product.supplierinfo)
May 18, 2022
Impacted versions:
14.0
Steps to reproduce:
product.supplierinfo
(we_product_tmpl_image = fields.Image(related='product_tmpl_id.image_256')
)<field name="we_product_tmpl_image" widget="image" />
)Current behavior:
Image wont load, because
product.supplierinfo.name
is a many2one:Expected behavior:
Image should load without error.
Maybe there should be a check, wether the filename is a record, and if yes, fall back to
display_name
?Or make filename_field configurable via an XML attribute on the widget.
The text was updated successfully, but these errors were encountered: