diff --git a/document_url/readme/CONTRIBUTORS.rst b/document_url/readme/CONTRIBUTORS.rst
index ad7a42c2..baf37eff 100644
--- a/document_url/readme/CONTRIBUTORS.rst
+++ b/document_url/readme/CONTRIBUTORS.rst
@@ -6,3 +6,4 @@
* Manuel Calero
* Víctor Martínez
* Matias Peralta - Adhoc SA
+* Emilio Pascual (`Moduon `__)
diff --git a/document_url/static/src/js/url.esm.js b/document_url/static/src/js/url.esm.js
index 99f5a4fb..d6f0a1cd 100644
--- a/document_url/static/src/js/url.esm.js
+++ b/document_url/static/src/js/url.esm.js
@@ -1,5 +1,6 @@
/** @odoo-module **/
+import {Activity} from "@mail/components/activity/activity";
import {AttachmentBox} from "@mail/components/attachment_box/attachment_box";
import {AttachmentCard} from "@mail/components/attachment_card/attachment_card";
import {patch} from "web.utils";
@@ -47,3 +48,33 @@ patch(AttachmentCard.prototype, "document_url/static/src/js/url.js", {
});
},
});
+
+patch(Activity.prototype, "document_url/static/src/js/url.js", {
+ _onAddUrl(event) {
+ event.preventDefault();
+ event.stopPropagation();
+ this.env.bus.trigger("do-action", {
+ action: "document_url.action_ir_attachment_add_url",
+ options: {
+ additional_context: {
+ active_id: this.messaging.models["mail.activity"].get(
+ this.props.activityLocalId
+ ).thread.id,
+ active_ids: [
+ this.messaging.models["mail.activity"].get(
+ this.props.activityLocalId
+ ).thread.id,
+ ],
+ active_model: this.messaging.models["mail.activity"].get(
+ this.props.activityLocalId
+ ).thread.model,
+ },
+ on_close: this._onAddedUrl.bind(this),
+ },
+ });
+ },
+ async _onAddedUrl() {
+ await this.activity.markAsDone({attachments: []});
+ this.trigger("o-attachments-changed");
+ },
+});
diff --git a/document_url/static/src/xml/url.xml b/document_url/static/src/xml/url.xml
index 42712d59..d492f7ed 100644
--- a/document_url/static/src/xml/url.xml
+++ b/document_url/static/src/xml/url.xml
@@ -54,4 +54,19 @@
+
+
+
+
+
+
+