-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from ONLYOFFICE/develop
Release/2.0.0
- Loading branch information
Showing
45 changed files
with
1,658 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[submodule "onlyoffice_odoo/static/assets/document_templates"] | ||
path = onlyoffice_odoo/static/assets/document_templates | ||
url = https://github.com/ONLYOFFICE/document-templates | ||
branch = main/new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
# Change Log | ||
|
||
## 2.0.0 | ||
## Added | ||
- support Documents module | ||
- opening file from Documents module | ||
- creating file in Document module | ||
|
||
## 1.0.0 | ||
## Added | ||
- edit option for DOCX, DOCXF, XLSX, PPTX | ||
- view option for DJVU, DOC, DOCM, DOT, DOTM, DOTX, EPUB, FB2, FODT, HTML, MHT, ODT, OFORM, OTT, OXPS, PDF, RTF, TXT, XPS, XML, CSV, FODS, ODS, OTS, XLS, XLSB, XLSM, XLT, XLTM, XLTX, FODP, ODP, OTP, POT, POTM, POTX, PPS, PPSM, PPSX, PPT, PPTM | ||
- collaboration editing | ||
- configuration page | ||
- Translations for DE, EN, ES, FR, IT, PT-BR, RU, ZH-CN | ||
- Translations for DE, EN, ES, FR, IT, PT-BR, RU, ZH-CN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule document_templates
added at
f00ab3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import controllers | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# -*- coding: utf-8 -*- | ||
{ | ||
'name': "ONLYOFFICE Documents", | ||
|
||
'summary': "Edit and collaborate on office files within Odoo Documents.", | ||
|
||
'description': "The ONLYOFFICE connector allows users to edit and collaborate on office files within Odoo Documents using ONLYOFFICE Docs. You can work with text documents, spreadsheets, and presentations, co-author documents in real time using two co-editing modes (Fast and Strict), Track Changes, comments, and built-in chat.", | ||
|
||
'author': "ONLYOFFICE", | ||
'website': "https://www.onlyoffice.com", | ||
|
||
'category': 'Productivity', | ||
'version': '2.0.1', | ||
|
||
'depends': ['onlyoffice_odoo', 'documents'], | ||
|
||
# always loaded | ||
'data': [ | ||
], | ||
|
||
'license': 'AGPL-3', | ||
'support': 'support@onlyoffice.com', | ||
|
||
'images': [], | ||
|
||
'installable': True, | ||
'application': True, | ||
|
||
'assets': { | ||
'mail.assets_messaging': [ | ||
'onlyoffice_odoo_documents/static/src/models/*.js', | ||
], | ||
'web.assets_backend': [ | ||
'onlyoffice_odoo_documents/static/src/components/*/*.xml', | ||
'onlyoffice_odoo_documents/static/src/documents_view/**/*', | ||
'onlyoffice_odoo_documents/static/src/onlyoffice_create_template/**/*', | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import controllers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# | ||
# (c) Copyright Ascensio System SIA 2023 | ||
# | ||
# This program is a free software product. You can redistribute it and/or | ||
# modify it under the terms of the GNU Affero General Public License (AGPL) | ||
# version 3 as published by the Free Software Foundation. In accordance with | ||
# Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect | ||
# that Ascensio System SIA expressly excludes the warranty of non-infringement | ||
# of any third-party rights. | ||
# | ||
# This program is distributed WITHOUT ANY WARRANTY; without even the implied | ||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For | ||
# details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html | ||
# | ||
# You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha | ||
# street, Riga, Latvia, EU, LV-1050. | ||
# | ||
# The interactive user interfaces in modified source and object code versions | ||
# of the Program must display Appropriate Legal Notices, as required under | ||
# Section 5 of the GNU AGPL version 3. | ||
# | ||
# Pursuant to Section 7(b) of the License you must retain the original Product | ||
# logo when distributing the program. Pursuant to Section 7(e) we decline to | ||
# grant you any rights under trademark law for use of our trademarks. | ||
# | ||
# All the Product's GUI elements, including illustrations and icon sets, as | ||
# well as technical writing content are licensed under the terms of the | ||
# Creative Commons Attribution-ShareAlike 4.0 International. See the License | ||
# terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode | ||
# | ||
|
||
import logging | ||
import json | ||
|
||
from odoo import http | ||
from odoo.http import request | ||
from odoo.tools.translate import _ | ||
|
||
from werkzeug.exceptions import Forbidden | ||
from odoo.exceptions import AccessError | ||
|
||
from odoo.addons.onlyoffice_odoo.utils import file_utils | ||
from odoo.addons.onlyoffice_odoo.controllers.controllers import Onlyoffice_Connector | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
class OnlyofficeDocuments_Connector(http.Controller): | ||
@http.route("/onlyoffice/documents/file/create", auth="user", methods=["POST"], type="json") | ||
def post_file_create(self, folder_id, format, title): | ||
result = {"error": None, "file_id": None} | ||
|
||
try: | ||
_logger.info("Getting new file template %s %s" % (request.env.user.lang, format)) | ||
file_data = file_utils.get_default_file_template(request.env.user.lang, format) | ||
|
||
data = { | ||
'name': title + "." + format, | ||
'mimetype': file_utils.get_mime_by_ext(format), | ||
'raw': file_data, | ||
'folder_id': int(folder_id) | ||
} | ||
|
||
document = request.env["documents.document"].create(data) | ||
result["file_id"] = document.attachment_id.id | ||
|
||
except Exception as ex: | ||
_logger.exception("Failed to create document %s" % str(ex)) | ||
result["error"] = _("Failed to create document") | ||
|
||
return json.dumps(result) | ||
|
||
class OnlyofficeDocuments_Inherited_Connector(Onlyoffice_Connector): | ||
@http.route("/onlyoffice/editor/document/<int:document_id>", auth="public", type="http", website=True) | ||
def render_document_editor(self, document_id, access_token=None): | ||
return request.render("onlyoffice_odoo.onlyoffice_editor", self.prepare_document_editor(document_id, access_token)) | ||
|
||
def prepare_document_editor(self, document_id, access_token): | ||
document = request.env['documents.document'].browse(int(document_id)) | ||
try: | ||
document.check_access_rule("read") | ||
except AccessError: | ||
_logger.error("User has no read access rights to open this document") | ||
raise Forbidden() | ||
|
||
attachment = self.get_attachment(document.attachment_id.id) | ||
if not attachment: | ||
_logger.error("Current document has no attachments") | ||
raise Forbidden() | ||
|
||
try: | ||
document.check_access_rule("write") | ||
return self.prepare_editor_values(attachment, access_token, True) | ||
except AccessError: | ||
_logger.debug("Current user has no write access") | ||
return self.prepare_editor_values(attachment, access_token, False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Prerequisites | ||
============= | ||
|
||
To be able to work with office files within Odoo Enterprise, you will need an instance of ONLYOFFICE Docs. You can install the `self-hosted version`_ of the editors or opt for `ONLYOFFICE Docs`_ which doesn't require downloading and installation. | ||
|
||
ONLYOFFICE app configuration | ||
============================ | ||
|
||
**Please note**: All the settings are configured from the `main ONLYOFFICE app for Odoo`_ which is installed automatically when you install ONLYOFFICE app for Odoo Enterprise. | ||
To adjust the main app settings within your Odoo, go to *Home menu -> Settings -> ONLYOFFICE*. | ||
|
||
In the **Document Server Url**, specify the URL of the installed ONLYOFFICE Docs or the address of ONLYOFFICE Docs Cloud. | ||
|
||
**Document Server JWT Secret**: JWT is enabled by default and the secret key is generated automatically to restrict the access to ONLYOFFICE Docs. if you want to specify your own secret key in this field, also specify the same secret key in the ONLYOFFICE Docs `config file`_ to enable the validation. | ||
|
||
**Document Server JWT Header**: Standard JWT header used in ONLYOFFICE is Authorization. In case this header is in conflict with your setup, you can change the header to the custom one. | ||
|
||
|
||
.. image:: settings.png | ||
:width: 800 | ||
|
||
|
||
Contact us | ||
========== | ||
|
||
If you have any questions or suggestions regarding the ONLYOFFICE app for Odoo, please let us know at https://forum.onlyoffice.com | ||
|
||
.. _self-hosted version: https://www.onlyoffice.com/download-docs.aspx | ||
.. _ONLYOFFICE Docs: https://www.onlyoffice.com/docs-registration.aspx | ||
.. _config file: https://api.onlyoffice.com/editors/signature/ | ||
.. _main ONLYOFFICE app for Odoo: https://apps.odoo.com/apps/modules/16.0/onlyoffice_odoo/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.