[MIG] document_url: Migration to 18.0

This commit is contained in:
Bhavesh Heliconia
2025-05-08 10:13:04 +05:30
parent 424d4218c2
commit e497ab162d
7 changed files with 68 additions and 60 deletions

View File

@@ -369,7 +369,7 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f8e881059b3485a5938ae6869a8bce008e4c891fc341fc845932995301df5402
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/knowledge/tree/17.0/document_url"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/knowledge-17-0/knowledge-17-0-document_url"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/knowledge&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/knowledge/tree/18.0/document_url"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/knowledge-18-0/knowledge-18-0-document_url"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/knowledge&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Module that allows to attach an URL as a document.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
@@ -402,7 +402,7 @@ related to the object.</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/knowledge/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/knowledge/issues/new?body=module:%20document_url%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/knowledge/issues/new?body=module:%20document_url%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -422,7 +422,11 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<li>Ernesto Tejeda</li>
<li>Manuel Calero</li>
<li>Víctor Martínez</li>
</ul>
</li>
<li>Matias Peralta - Adhoc SA</li>
<li><a class="reference external" href="https://www.heliconia.io">Heliconia Solutions Pvt. Ltd.</a><ul>
<li>Bhavesh Heliconia</li>
</ul>
</li>
</ul>
@@ -436,7 +440,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/17.0/document_url">OCA/knowledge</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/18.0/document_url">OCA/knowledge</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@@ -1,11 +1,18 @@
/** @odoo-module **/
import {AttachmentList} from "@mail/core/common/attachment_list";
import {Chatter} from "@mail/core/web/chatter";
import {ConfirmationDialog} from "@web/core/confirmation_dialog/confirmation_dialog";
import {Chatter} from "@mail/chatter/web_portal/chatter";
import {patch} from "@web/core/utils/patch";
import {useService} from "@web/core/utils/hooks";
import {url} from "@web/core/utils/urls";
import {_t} from "@web/core/l10n/translation";
patch(Chatter.prototype, {
setup() {
super.setup();
this.action = useService("action");
},
_onAddUrl(event) {
event.preventDefault();
event.stopPropagation();
@@ -64,4 +71,15 @@ patch(AttachmentList.prototype, {
download: true,
});
},
onClickUnlink(attachment) {
if (this.env.inComposer) {
return this.props.unlinkAttachment(attachment);
}
this.dialog.add(ConfirmationDialog, {
body: _t('Do you really want to delete "%s"?', attachment.name),
// eslint-disable-next-line no-empty-function
cancel: () => {},
confirm: () => this.onConfirmUnlink(attachment),
});
},
});

View File

@@ -29,21 +29,6 @@
</xpath>
</t>
<t t-inherit="mail.AttachmentList" t-inherit-mode="extension">
<xpath
expr="//div[hasclass('o-mail-AttachmentCard-aside')]//button[@title='Download']"
position="after"
>
<button
class="btn d-flex justify-content-center align-items-center w-100 h-100 rounded-0"
t-attf-class="bg-300"
t-on-click="() => window.open(attachmentUrl, '_blank')"
title="Open"
t-if="attachment.mimetype === 'application/link'"
target="_blank"
>
<i class="fa fa-link" role="img" aria-label="Open" />
</button>
</xpath>
<xpath
expr="//div[hasclass('o-mail-AttachmentCard-image')]"
position="attributes"