diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 474aa6f5..847b99e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,6 @@ exclude: | (?x) # NOT INSTALLABLE ADDONS - ^cmis_web_report_write_alf/| # END NOT INSTALLABLE ADDONS # Files and folders generated by bots, to avoid loops ^setup/|/static/description/index\.html$| diff --git a/cmis_web_report_write_alf/README.rst b/cmis_web_report_write_alf/README.rst new file mode 100644 index 00000000..e7d86988 --- /dev/null +++ b/cmis_web_report_write_alf/README.rst @@ -0,0 +1,34 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +========================= +Cmis Web Report Write Alf +========================= + +This module notify via the bus when a report is created in a Alfresco Folder + +Documentation: `alfodoo.org `_ + +Credits +======= + +Contributors +------------ + +* Laurent Mignon +* Maxime Franco + +Most of the code of the DocumentViewer widget is copied from `Odoo +`_ + + +Maintainer +---------- + +.. image:: https://www.acsone.eu/logo.png + :alt: ACSONE SA/NV + :target: http://www.acsone.eu + +This module is maintained by ACSONE SA/NV. diff --git a/cmis_web_report_write_alf/__manifest__.py b/cmis_web_report_write_alf/__manifest__.py index 1084e91a..fb0a2bc0 100644 --- a/cmis_web_report_write_alf/__manifest__.py +++ b/cmis_web_report_write_alf/__manifest__.py @@ -3,14 +3,19 @@ { "name": "Cmis Web Report Write Alf", - "description": """ + "summary": """ Automatically open generated editable reports into Alfresco""", - "version": "14.0.1.0.1", + "version": "16.0.1.0.1", "license": "AGPL-3", "author": "ACSONE SA/NV", "website": "https://alfodoo.org", "depends": ["cmis_web_report_write", "cmis_web_bus"], - "data": ["views/cmis_web_report_write_alf.xml"], + "data": [], "demo": [], - "installable": False, + "assets": { + "web.assets_backend": [ + "cmis_web_report_write_alf/static/src/**/*", + ], + }, + "installable": True, } diff --git a/cmis_web_report_write_alf/models/ir_actions_report.py b/cmis_web_report_write_alf/models/ir_actions_report.py index 29f3c736..b9c4ac35 100644 --- a/cmis_web_report_write_alf/models/ir_actions_report.py +++ b/cmis_web_report_write_alf/models/ir_actions_report.py @@ -32,5 +32,7 @@ def _create_cmis_document(self, buffer, record, file_name, cmis_parent_folder): "action": "open_url", "user_id": self.env.user.id, } - bus.sendone("notify_cmis_node", bus_message) + bus._sendone( + self.env.user.partner_id, "cmis_node_notification", bus_message + ) return res diff --git a/cmis_web_report_write_alf/static/src/js/cmis_folder.js b/cmis_web_report_write_alf/static/src/js/cmis_folder.js new file mode 100644 index 00000000..7d6cc6b0 --- /dev/null +++ b/cmis_web_report_write_alf/static/src/js/cmis_folder.js @@ -0,0 +1,23 @@ +/** @odoo-module **/ + +/* --------------------------------------------------------- ++ * Odoo cmis_web_bus ++ * Authors Laurent Mignon 2016, Maxime Franco 2023 Acsone SA/NV ++ * License in __openerp__.py at root level of the module ++ *--------------------------------------------------------- ++*/ + +import {CmisFolderField} from "@cmis_web/cmis_folder/cmis_folder"; +import {patch} from "web.utils"; + +patch(CmisFolderField.prototype, "cmis_folder_open_url", { + _handleNotify(event) { + this._super(event); + if (this.rootFolderId !== event.detail.cmis_objectid) { + return; + } + if (event.detail.action === "open_url") { + window.open(event.detail.url); + } + }, +}); diff --git a/cmis_web_report_write_alf/static/src/js/form_widgets.js b/cmis_web_report_write_alf/static/src/js/form_widgets.js deleted file mode 100644 index 00fddb04..00000000 --- a/cmis_web_report_write_alf/static/src/js/form_widgets.js +++ /dev/null @@ -1,26 +0,0 @@ -/* --------------------------------------------------------- - + * Odoo cmis_web - + * Author Laurent Mignon 2016 Acsone SA/NV - + * License in __openerp__.py at root level of the module - + *--------------------------------------------------------- - +*/ - -odoo.define("cmis_web_report_write_alf.form_widgets", function (require) { - "use strict"; - - require("cmis_web_bus.form_widgets"); - var form_widgets = require("cmis_web.form_widgets"); - - form_widgets.FieldCmisFolder.include({ - on_notify_cmis_node: function (message) { - this._super.apply(this, arguments); - var cmis_objectid = message.cmis_objectid; - if (this.root_folder_id !== cmis_objectid) { - return; - } - if (message.action === "open_url") { - window.open(message.url); - } - }, - }); -}); diff --git a/cmis_web_report_write_alf/views/cmis_web_report_write_alf.xml b/cmis_web_report_write_alf/views/cmis_web_report_write_alf.xml deleted file mode 100644 index 7396455b..00000000 --- a/cmis_web_report_write_alf/views/cmis_web_report_write_alf.xml +++ /dev/null @@ -1,15 +0,0 @@ - - -