Skip to content

Commit

Permalink
[MIG] cmis_web_bus - Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoMaxime committed Oct 4, 2023
1 parent 46597e3 commit da94685
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 71 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
exclude: |
(?x)
# NOT INSTALLABLE ADDONS
^cmis_web_bus/|
^cmis_web_proxy/|
^cmis_web_proxy_alf/|
^cmis_web_report_write/|
Expand Down
34 changes: 34 additions & 0 deletions cmis_web_bus/README.rst
Original file line number Diff line number Diff line change
@@ -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 Bus
============

This module provide an update of the cmis widget after adding a new file in the folder via the bus.

Documentation: `alfodoo.org <http://alfodoo.org>`_

Credits
=======

Contributors
------------

* Laurent Mignon <laurent.mignon@acsone.eu>
* Maxime Franco <maxime.franco@acsone.eu>

Most of the code of the DocumentViewer widget is copied from `Odoo
<https://github.com/odoo/odoo/blob/c1fa3b8ab3dfa1306dbdd3b6dc910405a3357d16
/addons/mail/static/src/js/document_viewer.js>`_


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.
11 changes: 7 additions & 4 deletions cmis_web_bus/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@

{
"name": "Cmis Web Bus",
"description": """
"summary": """
Instant Messaging Bus to send notification to the CMIS components
in live""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV",
"website": "https://alfodoo.org",
"depends": ["cmis_web", "bus"],
"data": ["views/cmis_web_bus.xml"],
"demo": [],
"installable": False,
"installable": True,
"assets": {
"web.assets_backend": [
"cmis_web_bus/static/src/**/*",
],
},
}
2 changes: 1 addition & 1 deletion cmis_web_bus/models/bus_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ def _notify_cmis_node(self, cmis_objectid, cmis_backend, action):
"action": action,
"user_id": self.env.user.id,
}
self.sendone("notify_cmis_node", bus_message)
self._sendone(self.env.user.partner_id, "cmis_node_notification", bus_message)
27 changes: 27 additions & 0 deletions cmis_web_bus/static/src/cmis_folder/cmis_folder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/** @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";
import {useBus, useService} from "@web/core/utils/hooks";

patch(CmisFolderField.prototype, "cmis_folder_notification", {
setup() {
this._super.apply(this, arguments);
this.cmis_service = useService("deliveryCmisService");
useBus(this.cmis_service, "cmis_bus", (event) => {
this._handleNotify(event);
});
},
async _handleNotify(event) {
if(event.detail.action === "update"){
this.queryCmisData();
}
},
});
27 changes: 27 additions & 0 deletions cmis_web_bus/static/src/cmis_folder/delivery_cmis_service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/** @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 {EventBus} from "@odoo/owl";
import {registry} from "@web/core/registry";

export const deliveryCmisService = {
dependencies: ["bus_service", "notification"],
start(_, {bus_service, notification}) {
const bus = new EventBus();
bus_service.addEventListener("notification", ({detail: notifications}) => {
for (const {payload, type} of notifications) {
if (type === "cmis_node_notification") {
bus.trigger("cmis_bus", payload);
}
}
});
return bus;
},
};
registry.category("services").add("deliveryCmisService", deliveryCmisService);
50 changes: 0 additions & 50 deletions cmis_web_bus/static/src/js/form_widgets.js

This file was deleted.

15 changes: 0 additions & 15 deletions cmis_web_bus/views/cmis_web_bus.xml

This file was deleted.

1 change: 1 addition & 0 deletions setup/cmis_web_bus/odoo/addons/cmis_web_bus
6 changes: 6 additions & 0 deletions setup/cmis_web_bus/setup.py
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,
)

0 comments on commit da94685

Please sign in to comment.