Code Monkey home page Code Monkey logo

onlyoffice_odoo's People

Contributors

eloncase avatar kseniafedoruk avatar linneys avatar maria-sukhova avatar nsenz avatar zerom22 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

onlyoffice_odoo's Issues

JWT issues, unable to view/edit attachments

Hi Everyone. We're running the OnlyOffice 15.0 module on Odoo 15 CE. Everything's setup as instructed on both sides. Docserver is running perfectly with other apps such as Nextcloud. When clicking on a PDF or DOCX attachment in Odoo, we're experiencing the "Download failed" popup in the browser with the following logs:

OnlyOffice Converter – out.log:

2023-12-10T08:20:49.711] [ERROR] [localhost] [8864c4582ab35193902b2ccfe343f3309d0d99233000] [9] nodeJS - error downloadFile:url=https://odoo-server/onlyoffice/file/content/8864?oo_security_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OX0.77HMdvpnCI3NdumWP8Tf-1VB2nbRUbD33eDJIlB3MSU;attempt=1;code:undefined;connect:undefined Error: Error response: statusCode:500; headers:{"server":"nginx/1.18.0","date":"Sun, 10 Dec 2023 00:20:49 GMT","content-type":"text/html;charset=utf-8","content-length":"1810","connection":"keep-alive","set-cookie":["frontend_lang=en_GB; Path=/","session_id=7474c96dd4fe46d662a4cbfc67703a675a95c143; Expires=Sat, 09-Mar-2024 00:20:49 GMT; Max-Age=7776000; HttpOnly; Path=/"]};
at Request.fResponse (/snapshot/server/build/server/Common/sources/utils.js)
at Request.emit (events.js:400:28)
at Request.onRequestResponse (/snapshot/server/build/server/Common/node_modules/request/request.js:1059:10)
at ClientRequest.emit (events.js:400:28)
at HTTPParser.parserOnIncomingClient (_http_client.js:647:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:127:17)
at TLSSocket.socketOnData (_http_client.js:515:22)
at TLSSocket.emit (events.js:400:28)
at addChunk (internal/streams/readable.js:293:12)
at readableAddChunk (internal/streams/readable.js:267:9)
at TLSSocket.Readable.push (internal/streams/readable.js:206:10)
at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23)

When directly accessing the URL above: https://odoo-server/onlyoffice/file/content/8864?oo_security_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OX0.77HMdvpnCI3NdumWP8Tf-1VB2nbRUbD33eDJIlB3MSU

The browser will show a 500 error with the following output:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/usr/lib/python3/dist-packages/odoo/http.py", line 815, in dispatch
r = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 368, 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 357, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 921, in call
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 546, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/onlyoffice_odoo/controllers/controllers.py", line 35, in onlyoffice_get_file_content
raise Exception("expected JWT")
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/usr/lib/python3/dist-packages/odoo/http.py", line 815, in dispatch
r = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 368, 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 357, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 921, in call
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 546, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/onlyoffice_odoo/controllers/controllers.py", line 35, in onlyoffice_get_file_content
raise Exception("expected JWT")
Exception: expected JWT

We tried disabling tokens in the local.json configuration and removed the JWT secret from the Odoo configuration. Accessing the URL above from a browser logged into Odoo results in a download (without the OnlyOffice interface). However, from a different machine, it displays a 500 error with the following in the Odoo log:

2023-12-10 03:05:42,669 1507395 ERROR odoo odoo.addons.http_routing.models.ir_http: 500 Internal Server Error:

Traceback (most recent call last):
File "/usr/lib/python3.9/base64.py", line 43, in _bytes_from_decode_data
return memoryview(s).tobytes()
TypeError: memoryview: a bytes-like object is required, not 'NoneType'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/usr/lib/python3/dist-packages/odoo/http.py", line 815, in dispatch
r = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 368, 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 357, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 921, in call
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 546, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/onlyoffice_odoo/controllers/controllers.py", line 41, in onlyoffice_get_file_content
content_base64 = base64.b64decode(content)
File "/usr/lib/python3.9/base64.py", line 80, in b64decode
s = _bytes_from_decode_data(s)
File "/usr/lib/python3.9/base64.py", line 45, in _bytes_from_decode_data
raise TypeError("argument should be a bytes-like object or ASCII "
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/usr/lib/python3/dist-packages/odoo/http.py", line 815, in dispatch
r = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 368, 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 357, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 921, in call
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 546, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/onlyoffice_odoo/controllers/controllers.py", line 41, in onlyoffice_get_file_content
content_base64 = base64.b64decode(content)
File "/usr/lib/python3.9/base64.py", line 80, in b64decode
s = _bytes_from_decode_data(s)
File "/usr/lib/python3.9/base64.py", line 45, in _bytes_from_decode_data
raise TypeError("argument should be a bytes-like object or ASCII "
TypeError: argument should be a bytes-like object or ASCII string, not 'NoneType'

Odoo & OnlyOffice are running on the same machine, both behind a Nginx proxy. They are being accessed from a remote network. We tried running a bare minimum Nginx configuration with the same results.

Any ideas? Happy to assist with the debugging process, thanks!

Dependency on documents

I'm using odoo community, for the module onlyoffice_odoo_documents it has a dependency of documents. I can't find this module so I suppose it's part of the odoo Enterprise.
Can you confirm?
Is there some integration with DMS module?

[edit]
I understood documents module is only in enterprise edition, it should be made clearer onlyoffice_odoo_documents is only for enterprise. Would be awesome to have integration with DMS if it's not too difficult.

Document is not updated in Odoo

Hi,
I'm testing this with the onlyoffice_odoo addon.
When I go to sales and add an attachment, I modify it and close the onlyoffice tab. Once I'm in odoo again clicking on download it doesn't update the document. Opening it inside of onlyoffice instead shows the changes.

This is tested with Odoo CE 16.0 and onlyoffice_odoo 16.0 extension.

Issues with Session Management and Multi-Database Support in OnlyOffice Connector for Odoo (v16 and v17)

Description:

We've encountered issues with the OnlyOffice connector for Odoo not functioning correctly in multi-database environments. Specifically, there are problems related to session management and selecting the correct database for incoming requests. This results in requests to the /onlyoffice/editor/callback/int:attachment_id endpoint returning a 404 error in environments with multiple databases.

Steps to Reproduce:

  • Set up an Odoo instance with multiple databases.
  • Configure the OnlyOffice connector according to the documentation.
  • Attempt to edit and save changes to a document using OnlyOffice.
  • Observe that requests to the callback endpoint fail with a 404 error when trying to access the database.

Additional Information:

  • Tested with Odoo16 and Odoo17 / Community and Enterprise
  • Connector versions 2.1.0 and 2.0.0
  • Documents Connector versions 2.1.0 and 2.0.0

Additional Context:

This issue might be related to or exacerbate the problems discussed in issue #18. A comprehensive review and potential resolution might benefit both issues.

Creation of New OnlyOffice Document Without Workspace Selection (v17)

Description:

When attempting to create a new OnlyOffice document within Odoo(17) Documents without selecting a workspace, the operation fails due to an SQL constraint violation error.
This issue arises because the folder_id column in the documents_document table cannot be null, but the creation process attempts to insert a new record without specifying this required field.
This behavior not only prevents the creation of new documents but also leads to a poor user experience due to the lack of a clear requirement or validation message prompting the user to select a workspace.

Steps to Reproduce:

  • Navigate to Odoo Documents.
  • Attempt to create a new OnlyOffice document without selecting a workspace/folder.
  • Observe the error as the operation fails.

Expected Behavior:
The system should either:

  • Prevent the user from attempting to create a new document without first selecting a workspace, by disabling the creation button or showing a validation message.
  • Automatically assign a default workspace if none is selected to ensure the folder_id constraint is satisfied.

Actual Behavior:
Attempting to create a new OnlyOffice document without selecting a workspace results in a SQL constraint violation error due to the folder_id column being null. The error message is as follows:

2024-02-18 16:18:28,578 47 ERROR test odoo.sql_db: bad query: INSERT INTO "documents_document" ("active", "attachment_id", "create_date", "create_uid", "folder_id", "is_editable_attachment", "name", "owner_id", "type", "write_date", "write_uid") VALUES (true, 39, '2024-02-18 16:18:28.545865', 2, NULL, false, 'Neues Dokument.docx', 2, 'empty', '2024-02-18 16:18:28.545865', 2) RETURNING "id"
ERROR: null value in column "folder_id" of relation "documents_document" violates not-null constraint
DETAIL:  Failing row contains (5, 39, null, null, null, 2, null, null, null, null, 2, 2, null, null, null, Neues Dokument.docx, null, null, null, empty, f, null, t, 2024-02-18 16:18:28.545865, 2024-02-18 16:18:28.545865, null).
 
2024-02-18 16:18:28,579 47 ERROR test odoo.addons.onlyoffice_odoo_documents.controllers.controllers: Failed to create document null value in column "folder_id" of relation "documents_document" violates not-null constraint
DETAIL:  Failing row contains (5, 39, null, null, null, 2, null, null, null, null, 2, 2, null, null, null, Neues Dokument.docx, null, null, null, empty, f, null, t, 2024-02-18 16:18:28.545865, 2024-02-18 16:18:28.545865, null).
 
Traceback (most recent call last):
  File "/mnt/custom-addons/foreign/onlyoffice_odoo_documents/controllers/controllers.py", line 38, in post_file_create
    document = request.env["documents.document"].create(data)
  File "<decorator-gen-166>", line 2, in create
  File "/mnt/odoo-server/odoo/api.py", line 414, in _model_create_multi
    return create(self, [arg])
  File "/mnt/enterprise-addons/documents_spreadsheet/models/documents_document.py", line 50, in create
    documents = super().create(vals_list)
  File "<decorator-gen-162>", line 2, in create
  File "/mnt/odoo-server/odoo/api.py", line 415, in _model_create_multi
    return create(self, arg)
  File "/mnt/enterprise-addons/documents/models/documents_document.py", line 515, in create
    documents = super().create(vals_list)
  File "<decorator-gen-128>", line 2, in create
  File "/mnt/odoo-server/odoo/api.py", line 415, in _model_create_multi
    return create(self, arg)
  File "/mnt/odoo-server/addons/mail/models/mail_thread.py", line 259, in create
    threads = super(MailThread, self).create(vals_list)
  File "<decorator-gen-12>", line 2, in create
  File "/mnt/odoo-server/odoo/api.py", line 415, in _model_create_multi
    return create(self, arg)
  File "/mnt/odoo-server/odoo/models.py", line 4601, in create
    records = self._create(data_list)
  File "/mnt/odoo-server/odoo/models.py", line 4789, in _create
    cr.execute(SQL(
  File "/mnt/odoo-server/odoo/sql_db.py", line 332, in execute
    res = self._obj.execute(query, params)
psycopg2.errors.NotNullViolation: null value in column "folder_id" of relation "documents_document" violates not-null constraint
DETAIL:  Failing row contains (5, 39, null, null, null, 2, null, null, null, null, 2, 2, null, null, null, Neues Dokument.docx, null, null, null, empty, f, null, t, 2024-02-18 16:18:28.545865, 2024-02-18 16:18:28.545865, null).

Possible Solutions:

  • Implement front-end validation to ensure a workspace is selected before allowing the user to proceed with document creation.
  • Modify the document creation logic to handle cases where no workspace is selected, possibly by assigning a default workspace.

Additional Information:

  • Odoo Version: 17 Enterprise
  • OnlyOffice Documents Connector Version: 2.1.0

500: Internal Server Error

500: Internal Server Error
(http://192.168.2.10:8069/onlyoffice/editor/document/5#error_traceback)
Traceback (most recent call last):
File "/home/odoo/odoo-src/odoo/http.py", line 1584, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/home/odoo/odoo-src/odoo/service/model.py", line 133, in retrying
result = func()
File "/home/odoo/odoo-src/odoo/http.py", line 1611, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/home/odoo/odoo-src/odoo/http.py", line 1725, in dispatch
return self.request.registry['ir.http']._dispatch(endpoint)
File "/home/odoo/odoo-src/odoo/addons/website/models/ir_http.py", line 235, in _dispatch
response = super()._dispatch(endpoint)
File "/home/odoo/odoo-src/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
result = endpoint(**request.params)
File "/home/odoo/odoo-src/odoo/http.py", line 697, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/home/odoo/extra-addons/onlyoffice_odoo_documents/controllers/controllers.py", line 50, in render_document_editor
return request.render("onlyoffice_odoo.onlyoffice_editor", self.prepare_document_editor(document_id, access_token))
File "/home/odoo/extra-addons/onlyoffice_odoo_documents/controllers/controllers.py", line 67, in prepare_document_editor
return self.prepare_editor_values(attachment, access_token, True)
File "/home/odoo/extra-addons/onlyoffice_odoo/controllers/controllers.py", line 126, in prepare_editor_values
security_token = jwt_utils.encode_payload(request.env, { "id": request.env.user.id }, config_utils.get_internal_jwt_secret(request.env))
File "/home/odoo/extra-addons/onlyoffice_odoo/utils/jwt_utils.py", line 15, in encode_payload
return jwt.encode(payload, secret, algorithm="HS256")
AttributeError: module 'jwt' has no attribute 'encode'

"An error occurs when trying to open .docx file(.doc is ok) documents using OnlyOffice in Odoo 16 Enterprise edition."

.xlsx is ok
but open .docx show this
500: Internal Server Error
跟踪

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1583, 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 1610, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1723, 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 696, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/usr/lib/python3/dist-packages/odoo/addons/onlyoffice_odoo/controllers/controllers.py", line 87, in render_editor
return request.render("onlyoffice_odoo.onlyoffice_editor", self.prepare_editor_values(attachment, access_token))
File "/usr/lib/python3/dist-packages/odoo/addons/onlyoffice_odoo/controllers/controllers.py", line 165, in prepare_editor_values
"key": str(data["id"]) + str(data["checksum"]),
TypeError: can only concatenate str (not "bool") to str

Correctly rename the module

In you README you are instructing to change the name of the module.

For odoo modules the best pratices is to name the module snake case with _ and also no one change modules path so the best is to go to your reference and change the modules to onlyoffice_odoo or make a new repository with correct name for the module.

Tested on ODOO 14 CE & 14 EE & 15 EE

I looked at the code, tried to install it in ODOO 14 CE & 14 EE & 15 EE from develop branch. Installation was succesfully, but the "Open in Onlyoffice" button is not displayed in AttacmentCard.

"An error occurs when trying to open .docx file(.doc is ok) documents using OnlyOffice in Odoo 16 Enterprise edition."

http://192.168.2.179:8069/onlyoffice/editor/272
500: Internal Server Error
跟踪
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1583, 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 1610, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1723, 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 696, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/usr/lib/python3/dist-packages/odoo/addons/onlyoffice_odoo/controllers/controllers.py", line 87, in render_editor
return request.render("onlyoffice_odoo.onlyoffice_editor", self.prepare_editor_values(attachment, access_token))
File "/usr/lib/python3/dist-packages/odoo/addons/onlyoffice_odoo/controllers/controllers.py", line 165, in prepare_editor_values
"key": str(data["id"]) + data["checksum"],
TypeError: can only concatenate str (not "bool") to str

Version History

Hi there,
How can I activate with file diff inside editor, in Odoo?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.