[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

@ -17,13 +17,13 @@ URL attachment
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github
:target: https://github.com/OCA/knowledge/tree/17.0/document_url :target: https://github.com/OCA/knowledge/tree/18.0/document_url
:alt: OCA/knowledge :alt: OCA/knowledge
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/knowledge-17-0/knowledge-17-0-document_url :target: https://translation.odoo-community.org/projects/knowledge-18-0/knowledge-18-0-document_url
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=17.0 :target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=18.0
:alt: Try me on Runboat :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -54,7 +54,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/knowledge/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/knowledge/issues>`_.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <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 <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**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@ -69,14 +69,18 @@ Authors
Contributors Contributors
------------ ------------
- Jonathan Nemry <jonathan.nemry@acsone.eu> - Jonathan Nemry <jonathan.nemry@acsone.eu>
- `Tecnativa <https://www.tecnativa.com>`__: - `Tecnativa <https://www.tecnativa.com>`__:
- Pedro M. Baeza - Pedro M. Baeza
- Ernesto Tejeda - Ernesto Tejeda
- Manuel Calero - Manuel Calero
- Víctor Martínez - Víctor Martínez
- Matias Peralta - Adhoc SA
- Matias Peralta - Adhoc SA
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__
- Bhavesh Heliconia
Maintainers Maintainers
----------- -----------
@ -91,6 +95,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/17.0/document_url>`_ project on GitHub. This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/18.0/document_url>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -2,7 +2,7 @@
# Copyright 2020 Tecnativa - Manuel Calero # Copyright 2020 Tecnativa - Manuel Calero
{ {
"name": "URL attachment", "name": "URL attachment",
"version": "17.0.1.0.1", "version": "18.0.1.0.0",
"category": "Tools", "category": "Tools",
"author": "Tecnativa, Odoo Community Association (OCA)", "author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/knowledge", "website": "https://github.com/OCA/knowledge",

View File

@ -4,4 +4,6 @@
- Ernesto Tejeda - Ernesto Tejeda
- Manuel Calero - Manuel Calero
- Víctor Martínez - Víctor Martínez
- Matias Peralta - Adhoc SA - Matias Peralta - Adhoc SA
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
- Bhavesh Heliconia

View File

@ -369,7 +369,7 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f8e881059b3485a5938ae6869a8bce008e4c891fc341fc845932995301df5402 !! 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>Module that allows to attach an URL as a document.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <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>. <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. 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 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> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <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>Ernesto Tejeda</li>
<li>Manuel Calero</li> <li>Manuel Calero</li>
<li>Víctor Martínez</li> <li>Víctor Martínez</li>
</ul>
</li>
<li>Matias Peralta - Adhoc SA</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> </ul>
</li> </li>
</ul> </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 <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> 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> <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>
</div> </div>

View File

@ -1,11 +1,18 @@
/** @odoo-module **/ /** @odoo-module **/
import {AttachmentList} from "@mail/core/common/attachment_list"; 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 {patch} from "@web/core/utils/patch";
import {useService} from "@web/core/utils/hooks";
import {url} from "@web/core/utils/urls"; import {url} from "@web/core/utils/urls";
import {_t} from "@web/core/l10n/translation";
patch(Chatter.prototype, { patch(Chatter.prototype, {
setup() {
super.setup();
this.action = useService("action");
},
_onAddUrl(event) { _onAddUrl(event) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
@ -64,4 +71,15 @@ patch(AttachmentList.prototype, {
download: true, 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> </xpath>
</t> </t>
<t t-inherit="mail.AttachmentList" t-inherit-mode="extension"> <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 <xpath
expr="//div[hasclass('o-mail-AttachmentCard-image')]" expr="//div[hasclass('o-mail-AttachmentCard-image')]"
position="attributes" position="attributes"

View File

@ -7,31 +7,26 @@
<field name='target'>new</field> <field name='target'>new</field>
<field name='view_mode'>form</field> <field name='view_mode'>form</field>
</record> </record>
<data>
<record id="view_ir_attachment_add_url_form" model="ir.ui.view"> <record id="view_ir_attachment_add_url_form" model="ir.ui.view">
<field name="name">ir.attachment.add_url.form</field> <field name="name">ir.attachment.add_url.form</field>
<field name="model">ir.attachment.add_url</field> <field name="model">ir.attachment.add_url</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Add URL"> <form string="Add URL">
<group> <group>
<field name="name" /> <field name="name" />
<field name="url" widget="url" /> <field name="url" widget="url" />
</group> </group>
<footer> <footer>
<button <button
name="action_add_url" name="action_add_url"
string="Add" string="Add"
class="oe_highlight" class="oe_highlight"
type="object" type="object"
/> />
<button <button special="cancel" string="Cancel" class="btn-secondary" />
special="cancel" </footer>
string="Cancel" </form>
class="btn-secondary" </field>
/> </record>
</footer>
</form>
</field>
</record>
</data>
</odoo> </odoo>