-
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
17 changed files
with
1,093 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
setup/web_editor_media_dialog_dms/odoo/addons/web_editor_media_dialog_dms
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 @@ | ||
../../../../web_editor_media_dialog_dms |
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,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
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 @@ | ||
=========================== | ||
Web Editor Media Dialog DMS | ||
=========================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:61e7939eaa7373b7c5114e669fe2cb623fba465e7f682708680aebee1ceddee2 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fdms-lightgray.png?logo=github | ||
:target: https://github.com/OCA/dms/tree/16.0/web_editor_media_dialog_dms | ||
:alt: OCA/dms | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/dms-16-0/dms-16-0-web_editor_media_dialog_dms | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/dms&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module adds the option in the web editor to include an image with the | ||
corresponding link to open/download the linked files. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, we need: | ||
|
||
#. Navigate to a model that has an HTML field | ||
#. Edit the field | ||
#. Type /image to open the media dialog | ||
#. Select the DMS tab | ||
#. Select the DMS file to be added | ||
|
||
You can also edit the selected file making a double click on the image added to web | ||
editor. | ||
|
||
If you want to share the file to a public user, you can do it by selecting the option | ||
**Allow open to public users** which is located on DMS tab of media dialog. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/dms/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/dms/issues/new?body=module:%20web_editor_media_dialog_dms%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Tecnativa | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Pedro M. Baeza | ||
* Carlos Roca | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
This module is part of the `OCA/dms <https://github.com/OCA/dms/tree/16.0/web_editor_media_dialog_dms>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
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 @@ | ||
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,17 @@ | ||
# Copyright 2024 Tecnativa - Carlos Roca | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Web Editor Media Dialog DMS", | ||
"summary": "Integrate DMS with media dialog of web editor", | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "Tecnativa, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/dms", | ||
"depends": ["dms", "web_editor"], | ||
"assets": { | ||
"web_editor.assets_media_dialog": [ | ||
"web_editor_media_dialog_dms/static/src/media_dialog/*", | ||
] | ||
}, | ||
} |
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,70 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * web_editor_media_dialog_dms | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-08-22 09:04+0000\n" | ||
"PO-Revision-Date: 2024-08-22 11:05+0200\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"X-Generator: Poedit 3.0.1\n" | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#. odoo-javascript | ||
#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 | ||
#, python-format | ||
msgid "All DMS files have been loaded" | ||
msgstr "Todos los archivos DMS han sido cargados" | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#. odoo-javascript | ||
#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 | ||
#, python-format | ||
msgid "Allow open to public users" | ||
msgstr "Permitir abrir enlace a usuarios públicos" | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#: model:ir.model,name:web_editor_media_dialog_dms.model_dms_file | ||
msgid "File" | ||
msgstr "Archivo" | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#: model:ir.model,name:web_editor_media_dialog_dms.model_ir_binary | ||
msgid "File streaming helper model for controllers" | ||
msgstr "Modelo de ayuda para la transmisión de archivos para controladores" | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#. odoo-python | ||
#: code:addons/web_editor_media_dialog_dms/models/dms_file.py:0 | ||
#, python-format | ||
msgid "Invalid access token" | ||
msgstr "Token de acceso inválido" | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#. odoo-javascript | ||
#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 | ||
#, python-format | ||
msgid "Load more..." | ||
msgstr "Cargar más..." | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#. odoo-javascript | ||
#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 | ||
#, python-format | ||
msgid "No DMS files found." | ||
msgstr "No se encontraron archivos DMS." | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#. odoo-javascript | ||
#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.esm.js:0 | ||
#, python-format | ||
msgid "Search a dms file" | ||
msgstr "Buscar un archivo DMS" |
68 changes: 68 additions & 0 deletions
68
web_editor_media_dialog_dms/i18n/web_editor_media_dialog_dms.pot
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,68 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * web_editor_media_dialog_dms | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-08-22 09:04+0000\n" | ||
"PO-Revision-Date: 2024-08-22 09:04+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#. odoo-javascript | ||
#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 | ||
#, python-format | ||
msgid "All DMS files have been loaded" | ||
msgstr "" | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#. odoo-javascript | ||
#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 | ||
#, python-format | ||
msgid "Allow open to public users" | ||
msgstr "" | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#: model:ir.model,name:web_editor_media_dialog_dms.model_dms_file | ||
msgid "File" | ||
msgstr "" | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#: model:ir.model,name:web_editor_media_dialog_dms.model_ir_binary | ||
msgid "File streaming helper model for controllers" | ||
msgstr "" | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#. odoo-python | ||
#: code:addons/web_editor_media_dialog_dms/models/dms_file.py:0 | ||
#, python-format | ||
msgid "Invalid access token" | ||
msgstr "" | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#. odoo-javascript | ||
#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 | ||
#, python-format | ||
msgid "Load more..." | ||
msgstr "" | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#. odoo-javascript | ||
#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 | ||
#, python-format | ||
msgid "No DMS files found." | ||
msgstr "" | ||
|
||
#. module: web_editor_media_dialog_dms | ||
#. odoo-javascript | ||
#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.esm.js:0 | ||
#, python-format | ||
msgid "Search a dms file" | ||
msgstr "" |
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,2 @@ | ||
from . import dms_file | ||
from . import ir_binary |
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,26 @@ | ||
# Copyright 2024 Tecnativa - Carlos Roca | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from odoo import _, models | ||
from odoo.exceptions import AccessError | ||
from odoo.tools import consteq | ||
|
||
|
||
class File(models.Model): | ||
_inherit = "dms.file" | ||
|
||
def get_access_token(self): | ||
self.ensure_one() | ||
return self._portal_ensure_token() | ||
|
||
def validate_access(self, access_token): | ||
# Validate if token provided is correct for the record checked | ||
self.ensure_one() | ||
record_sudo = self.sudo() | ||
if access_token: | ||
tok = record_sudo.with_context(prefetch_fields=False).access_token | ||
valid_token = consteq(tok or "", access_token) | ||
if not valid_token: | ||
raise AccessError(_("Invalid access token")) | ||
return record_sudo | ||
return self |
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,15 @@ | ||
# Copyright 2024 Tecnativa - Carlos Roca | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class IrBinary(models.AbstractModel): | ||
_inherit = "ir.binary" | ||
|
||
def _find_record_check_access(self, record, access_token): | ||
# The method is overridden to allow access to the media attached to the | ||
# dms.file records using an access_token. | ||
if record._name == "dms.file": | ||
return record.validate_access(access_token) | ||
return super()._find_record_check_access(record, access_token) |
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 @@ | ||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Pedro M. Baeza | ||
* Carlos Roca |
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,2 @@ | ||
This module adds the option in the web editor to include an image with the | ||
corresponding link to open/download the linked files. |
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,13 @@ | ||
To use this module, we need: | ||
|
||
#. Navigate to a model that has an HTML field | ||
#. Edit the field | ||
#. Type /image to open the media dialog | ||
#. Select the DMS tab | ||
#. Select the DMS file to be added | ||
|
||
You can also edit the selected file making a double click on the image added to web | ||
editor. | ||
|
||
If you want to share the file to a public user, you can do it by selecting the option | ||
**Allow open to public users** which is located on DMS tab of media dialog. |
Oops, something went wrong.