Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documents app preview issue #313

Open
JacooRe opened this issue Dec 13, 2023 · 0 comments
Open

Documents app preview issue #313

JacooRe opened this issue Dec 13, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@JacooRe
Copy link

JacooRe commented Dec 13, 2023

Module

fs_attachment / fs_storage

Describe the bug

When using s3 storage for all attachments - unable to preview file (pdf, jpg, gif .... ) in Documents app
image

workaround

if I upload an attachment (pdf) to TASK - I can preview it inside the task
but if I try to preview the PDF via Documents app, throws error like on screenshot
copy from docker container error:

2023-12-13 17:20:25,651 15 ERROR odoo odoo.http: Exception during request handling. 
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1988, in __call__
    response = request._serve_db()
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1584, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 134, in retrying
    result = func()
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1611, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1724, in dispatch
    return self.request.registry['ir.http']._dispatch(endpoint)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
    result = endpoint(**request.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 699, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/binary.py", line 75, in content_common
    stream = request.env['ir.binary']._get_stream_from(record, field, filename, filename_field, mimetype)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_binary.py", line 129, in _get_stream_from
    stream = self._record_to_stream(record, field_name)
  File "/mnt/extra-addons/documents/models/ir_binary.py", line 11, in _record_to_stream
    return Stream.from_attachment(record.attachment_id.sudo())
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 475, in from_attachment
    stat = os.stat(self.path)
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/odoo/filestore/odoo/abcd123a1:/so2023_3360347-2-31088-0.pdf'

For some reason, the Documents preview is looking into some local folder (which doesnt exist)

To Reproduce

Affected versions:
odoo 16
fs_attachment+fs_storage latest
documents app

Steps to reproduce the behavior:

  1. setup s3 for all attachments
  2. upload file (eg. pdf) to Documents app
  3. try to open the file in Documents app

Expected behavior
Open/preview the file (pdf, jpg...whatever)

@JacooRe JacooRe added the bug Something isn't working label Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant