mirror of
https://github.com/OCA/knowledge.git
synced 2025-12-20 12:22:18 -06:00
[MIG] document_url: Migration to 14.0
TT30263
This commit is contained in:
committed by
FernandoRomera
parent
5efdde8269
commit
4aa14473eb
@@ -3,30 +3,31 @@
|
||||
* Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
|
||||
* Copyright 2019 Tecnativa - Ernesto Tejeda
|
||||
* Copyright 2020 Tecnativa - Manuel Calero
|
||||
* Copyright 2021 Tecnativa - Víctor Martínez
|
||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
*/
|
||||
odoo.define("document_url", function (require) {
|
||||
"use strict";
|
||||
|
||||
var AttachmentBox = require("mail.AttachmentBox");
|
||||
const AttachmentBox = require("mail/static/src/components/attachment_box/attachment_box.js");
|
||||
const {patch} = require("web.utils");
|
||||
|
||||
AttachmentBox.include({
|
||||
events: _.extend(AttachmentBox.prototype.events, {
|
||||
"click button.o_add_url_button": "_onAddUrl",
|
||||
}),
|
||||
_onAddUrl: function () {
|
||||
// Opens wizard to add an URL attachment to the current record
|
||||
this.do_action("document_url.action_ir_attachment_add_url", {
|
||||
additional_context: {
|
||||
active_id: this.currentResID,
|
||||
active_ids: [this.currentResID],
|
||||
active_model: this.currentResModel,
|
||||
patch(AttachmentBox, "document_url", {
|
||||
_onAddUrl() {
|
||||
this.env.bus.trigger("do-action", {
|
||||
action: "document_url.action_ir_attachment_add_url",
|
||||
options: {
|
||||
additional_context: {
|
||||
active_id: this.thread.id,
|
||||
active_ids: [this.thread.id],
|
||||
active_model: this.thread.model,
|
||||
},
|
||||
on_close: this._onAddedUrl.bind(this),
|
||||
},
|
||||
on_close: this._onAddedUrl.bind(this),
|
||||
});
|
||||
},
|
||||
_onAddedUrl: function () {
|
||||
this.trigger_up("reload_attachment_box");
|
||||
_onAddedUrl() {
|
||||
this.trigger("reload");
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!-- Copyright 2018 Tecnativa - Ernesto Tejeda
|
||||
Copyright 2021 Tecnativa - Víctor Martínez
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t t-extend="mail.AttachmentBox">
|
||||
<t t-jquery="button.o_AttachmentBox_buttonAdd" t-operation="after">
|
||||
<templates xml:space="preserve">
|
||||
<t t-inherit="mail.AttachmentBox" t-inherit-mode="extension" owl="1">
|
||||
<xpath expr="//button[hasclass('o_AttachmentBox_buttonAdd')]" position="after">
|
||||
<button
|
||||
type="button"
|
||||
class="o_add_url_button btn btn-link"
|
||||
t-on-click="_onClickAdd"
|
||||
t-on-click="_onAddUrl"
|
||||
>
|
||||
<i class="fa fa-plus-square" />
|
||||
Add URL
|
||||
</button>
|
||||
</t>
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
||||
|
||||
Reference in New Issue
Block a user