mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-14 01:41:26 -06:00
[16.0][FIX] document_url: Add URL button and paperclip button
This commit is contained in:
parent
ddd0df7e51
commit
e080dc24ec
@ -1,30 +1,31 @@
|
|||||||
/** @odoo-module **/
|
/** @odoo-module **/
|
||||||
|
|
||||||
import {AttachmentBox} from "@mail/components/attachment_box/attachment_box";
|
import {registerPatch} from "@mail/model/model_core";
|
||||||
import {AttachmentCard} from "@mail/components/attachment_card/attachment_card";
|
import {AttachmentCard} from "@mail/components/attachment_card/attachment_card";
|
||||||
import {patch} from "web.utils";
|
import {patch} from "web.utils";
|
||||||
import {url} from "@web/core/utils/urls";
|
import {url} from "@web/core/utils/urls";
|
||||||
|
|
||||||
patch(AttachmentBox.prototype, "document_url/static/src/js/url.js", {
|
registerPatch({
|
||||||
|
name: "AttachmentBoxView",
|
||||||
|
recordMethods: {
|
||||||
_onAddUrl(event) {
|
_onAddUrl(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
if (this.env.model) {
|
|
||||||
this.env.services.action.doAction(
|
this.env.services.action.doAction(
|
||||||
"document_url.action_ir_attachment_add_url",
|
"document_url.action_ir_attachment_add_url",
|
||||||
{
|
{
|
||||||
additionalContext: {
|
additionalContext: {
|
||||||
active_id: this.env.model.root.data.id,
|
active_id: this.chatter.thread.id,
|
||||||
active_ids: [this.env.model.root.data.id],
|
active_ids: [this.chatter.thread.id],
|
||||||
active_model: this.env.model.root.resModel,
|
active_model: this.chatter.thread.model,
|
||||||
},
|
},
|
||||||
onClose: this._onAddedUrl.bind(this),
|
onClose: this._onAddedUrl.bind(this),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
_onAddedUrl() {
|
_onAddedUrl() {
|
||||||
this.props.record.chatter.refresh();
|
this.chatter.refresh();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="o_add_url_button btn btn-link"
|
class="o_add_url_button btn btn-link"
|
||||||
t-on-click="_onAddUrl"
|
t-on-click="attachmentBoxView._onAddUrl"
|
||||||
>
|
>
|
||||||
<i class="fa fa-plus-square" />
|
<i class="fa fa-plus-square" />
|
||||||
Add URL
|
Add URL
|
||||||
@ -70,4 +70,16 @@
|
|||||||
</a>
|
</a>
|
||||||
</xpath>
|
</xpath>
|
||||||
</t>
|
</t>
|
||||||
|
<t t-inherit="mail.ChatterTopbar" t-inherit-mode="extension" owl="1">
|
||||||
|
<xpath
|
||||||
|
expr="//button[hasclass('o_ChatterTopbar_buttonAddAttachments')]"
|
||||||
|
position="replace"
|
||||||
|
/>
|
||||||
|
<xpath
|
||||||
|
expr="//button[hasclass('o_ChatterTopbar_buttonToggleAttachments')]"
|
||||||
|
position="attributes"
|
||||||
|
>
|
||||||
|
<attribute name="t-if" />
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
</templates>
|
</templates>
|
||||||
|
Loading…
Reference in New Issue
Block a user