mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-23 17:08:46 -06:00
[15.0] [IMP] document_url: upload url from upload activity
Co-authored-by: Jairo Llopis <973709+yajo@users.noreply.github.com>
This commit is contained in:
parent
96ae338925
commit
0058b7878a
@ -6,3 +6,4 @@
|
|||||||
* Manuel Calero
|
* Manuel Calero
|
||||||
* Víctor Martínez
|
* Víctor Martínez
|
||||||
* Matias Peralta - Adhoc SA
|
* Matias Peralta - Adhoc SA
|
||||||
|
* Emilio Pascual (`Moduon <https://www.moduon.team/>`__)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/** @odoo-module **/
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import {Activity} from "@mail/components/activity/activity";
|
||||||
import {AttachmentBox} from "@mail/components/attachment_box/attachment_box";
|
import {AttachmentBox} from "@mail/components/attachment_box/attachment_box";
|
||||||
import {AttachmentCard} from "@mail/components/attachment_card/attachment_card";
|
import {AttachmentCard} from "@mail/components/attachment_card/attachment_card";
|
||||||
import {patch} from "web.utils";
|
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");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
@ -54,4 +54,19 @@
|
|||||||
</a>
|
</a>
|
||||||
</xpath>
|
</xpath>
|
||||||
</t>
|
</t>
|
||||||
|
|
||||||
|
<t t-inherit="mail.Activity" t-inherit-mode="extension" owl="1">
|
||||||
|
<xpath
|
||||||
|
expr="//div[hasclass('o_Activity_tools')]//t[2]/FileUploader"
|
||||||
|
position="after"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="o_Activity_toolButton o_Activity_uploadButton btn btn-link"
|
||||||
|
t-on-click="_onAddUrl"
|
||||||
|
>
|
||||||
|
<i class="fa fa-link" /> Link document by URL</button>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
|
||||||
</templates>
|
</templates>
|
||||||
|
Loading…
Reference in New Issue
Block a user