Skip to content

Commit

Permalink
[FIX] Fix Download attachment
Browse files Browse the repository at this point in the history
This commit (odoo/odoo@366676c) move download buttans 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.
  • Loading branch information
maq-adhoc committed Nov 7, 2024
1 parent 2853b87 commit 2e90b9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 5 additions & 0 deletions document_url/static/src/js/url.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ patch(AttachmentList.prototype, {
*
* @returns {String}
*/
canDownload(attachment) {
return (
super.canDownload(attachment) && attachment.mimetype != 'application/link'
);
},
get attachmentUrl() {
return url("/web/content", {
id: this.attachment.id,
Expand Down
6 changes: 0 additions & 6 deletions document_url/static/src/xml/url.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@
</xpath>
</t>
<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
expr="//div[hasclass('o-mail-AttachmentCard-aside')]//button[@title='Download']"
position="after"
Expand Down

0 comments on commit 2e90b9b

Please sign in to comment.