[FIX] document_url: Migration was not done properly

This commit is contained in:
Enric Tobella
2023-06-06 09:31:41 +02:00
parent c02d5bd950
commit 41b50c5c65
4 changed files with 44 additions and 54 deletions

View File

@@ -3,33 +3,28 @@
import {AttachmentBox} from "@mail/components/attachment_box/attachment_box";
import {AttachmentCard} from "@mail/components/attachment_card/attachment_card";
import {patch} from "web.utils";
import {url} from "@web/core/utils/urls";
patch(AttachmentBox.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.chatter"].get(
this.props.chatterLocalId
).threadId,
active_ids: [
this.messaging.models["mail.chatter"].get(
this.props.chatterLocalId
).threadId,
],
active_model: this.messaging.models["mail.chatter"].get(
this.props.chatterLocalId
).threadModel,
},
on_close: this._onAddedUrl.bind(this),
},
});
if (this.env.model) {
this.env.services.action.doAction(
"document_url.action_ir_attachment_add_url",
{
additionalContext: {
active_id: this.env.model.root.data.id,
active_ids: [this.env.model.root.data.id],
active_model: this.env.model.root.resModel,
},
onClose: this._onAddedUrl.bind(this),
}
);
}
},
_onAddedUrl() {
this.trigger("reload");
this.props.record.chatter.refresh();
},
});
@@ -41,7 +36,7 @@ patch(AttachmentCard.prototype, "document_url/static/src/js/url.js", {
* @returns {String}
*/
get attachmentUrl() {
return this.env.session.url("/web/content", {
return url("/web/content", {
id: this.attachmentCard.attachment.id,
download: true,
});