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");
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user