From 883243cd6d7e94a634ed74486e33c22e1a104d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Wed, 9 Oct 2024 08:54:30 +0200 Subject: [PATCH] [MIG] dms_attachment_link: Migration to 17.0 TT50055 --- dms/views/dms_file.xml | 2 +- dms_attachment_link/__manifest__.py | 2 +- .../static/src/js/dms_attachment_link.esm.js | 52 ++++++++----------- .../static/src/xml/chatter.xml | 11 ++-- 4 files changed, 27 insertions(+), 40 deletions(-) diff --git a/dms/views/dms_file.xml b/dms/views/dms_file.xml index b2bb6ba9a..48785b1ad 100644 --- a/dms/views/dms_file.xml +++ b/dms/views/dms_file.xml @@ -281,7 +281,7 @@ - o_kanban_mobile + o_kanban_mobile mk_file_kanban_view
diff --git a/dms_attachment_link/__manifest__.py b/dms_attachment_link/__manifest__.py index dcf7d3b43..2df545e42 100644 --- a/dms_attachment_link/__manifest__.py +++ b/dms_attachment_link/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Dms Attachment Link", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "category": "Document Management", "website": "https://github.com/OCA/dms", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/dms_attachment_link/static/src/js/dms_attachment_link.esm.js b/dms_attachment_link/static/src/js/dms_attachment_link.esm.js index 6b8f31e8a..4a42a0ab7 100644 --- a/dms_attachment_link/static/src/js/dms_attachment_link.esm.js +++ b/dms_attachment_link/static/src/js/dms_attachment_link.esm.js @@ -1,37 +1,27 @@ /** @odoo-module **/ -import {registerPatch} from "@mail/model/model_core"; +import {Chatter} from "@mail/core/web/chatter"; +import {patch} from "@web/core/utils/patch"; -registerPatch({ - name: "AttachmentBoxView", - recordMethods: { - _onAddDmsFile() { - this.env.services.action.doAction( - "dms_attachment_link.action_dms_file_wizard_selector_dms_attachment_link", - { - additionalContext: { - active_id: this.chatter.thread.id, - active_ids: [this.chatter.thread.id], - active_model: this.chatter.threadModel, - }, - onClose: this._onAddedDmsFile.bind(this), - } - ); - }, - _onAddedDmsFile() { - this.chatter.refresh(); - }, +patch(Chatter.prototype, { + _onAddDmsFile(event) { + event.preventDefault(); + event.stopPropagation(); + this.action.doAction( + "dms_attachment_link.action_dms_file_wizard_selector_dms_attachment_link", + { + additionalContext: { + active_id: this.state.thread.id, + active_ids: [this.state.thread.id], + active_model: this.state.thread.model, + }, + onClose: async () => { + await this._onAddedDmsFile(); + }, + } + ); }, -}); - -registerPatch({ - name: "Chatter", - recordMethods: { - /** - * Handles click on the attach button. - */ - async onClickButtonAddAttachments() { - await this.onClickButtonToggleAttachments(); - }, + async _onAddedDmsFile() { + this.reloadParentView(); }, }); diff --git a/dms_attachment_link/static/src/xml/chatter.xml b/dms_attachment_link/static/src/xml/chatter.xml index 187c81dbc..0276eeeee 100644 --- a/dms_attachment_link/static/src/xml/chatter.xml +++ b/dms_attachment_link/static/src/xml/chatter.xml @@ -1,16 +1,13 @@ - - - - - - + +