[FIX] document_url: Fix Download attachment component

Fix download atachment widget.

Document_url when activated causes error when opening attachment link on the chatter window
This commit (366676cafd) move download buttons into a sub-component.
I modified the module behavior to use canDownload() method instead of adding a t-if in the view and prevent the chatter component from breaking when the message has attachments.
This commit is contained in:
Martin Quinteros 2024-11-07 16:04:59 -03:00 committed by Bhavesh Heliconia
parent 24004ca1b2
commit 2fb1f655c7
2 changed files with 5 additions and 6 deletions

View File

@ -52,6 +52,11 @@ patch(AttachmentList.prototype, {
* *
* @returns {String} * @returns {String}
*/ */
canDownload(attachment) {
return (
super.canDownload(attachment) && attachment.mimetype != "application/link"
);
},
get attachmentUrl() { get attachmentUrl() {
return url("/web/content", { return url("/web/content", {
id: this.attachment.id, id: this.attachment.id,

View File

@ -30,12 +30,6 @@
</xpath> </xpath>
</t> </t>
<t t-inherit="mail.AttachmentList" t-inherit-mode="extension"> <t t-inherit="mail.AttachmentList" t-inherit-mode="extension">
<xpath
expr="//div[contains(@class, 'o-mail-AttachmentCard-aside')]//button[@title='Download']"
position="attributes"
>
<attribute name="t-if">attachment.mimetype != 'application/link'</attribute>
</xpath>
<xpath <xpath
expr="//div[hasclass('o-mail-AttachmentCard-aside')]//button[@title='Download']" expr="//div[hasclass('o-mail-AttachmentCard-aside')]//button[@title='Download']"
position="after" position="after"