mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-14 01:41:26 -06:00
[MIG] document_url: Migration to 13.0
This commit is contained in:
parent
9260841adf
commit
7b35822534
@ -1,4 +1,4 @@
|
||||
# Copyright 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
|
||||
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
|
||||
# Copyright 2014 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
|
||||
from . import wizard
|
||||
|
@ -1,15 +1,13 @@
|
||||
# Copyright 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
|
||||
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
|
||||
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
|
||||
# Copyright 2014 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2020 Tecnativa - Manuel Calero
|
||||
{
|
||||
"name": "URL attachment",
|
||||
"version": "13.0.1.0.0",
|
||||
"category": "Tools",
|
||||
"author": "Tecnativa," "Odoo Community Association (OCA)",
|
||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/knowledge",
|
||||
"license": "AGPL-3",
|
||||
"data": ["view/document_url_view.xml", "security/ir.model.access.csv"],
|
||||
"data": ["view/document_url_view.xml"],
|
||||
"qweb": ["static/src/xml/url.xml"],
|
||||
"installable": True,
|
||||
}
|
||||
|
@ -4,3 +4,4 @@
|
||||
* Pedro M. Baeza
|
||||
* Ernesto Tejeda
|
||||
* Manuel Calero
|
||||
* Víctor Martínez
|
||||
|
@ -1,2 +0,0 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_ir_attachment_add_url,access_ir_attachment_add_url,model_ir_attachment_add_url,,1,1,1,1
|
|
@ -5,28 +5,28 @@
|
||||
* Copyright 2020 Tecnativa - Manuel Calero
|
||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
*/
|
||||
odoo.define('document_url', function (require) {
|
||||
odoo.define("document_url", function(require) {
|
||||
"use strict";
|
||||
|
||||
var AttachmentBox = require('mail.AttachmentBox');
|
||||
var AttachmentBox = require("mail.AttachmentBox");
|
||||
|
||||
AttachmentBox.include({
|
||||
events: _.extend(AttachmentBox.prototype.events, {
|
||||
"click span.o_add_url_button": "_onAddUrl",
|
||||
}),
|
||||
_onAddUrl: function () {
|
||||
_onAddUrl: function() {
|
||||
// Opens wizard to add an URL attachment to the current record
|
||||
this.do_action('document_url.action_ir_attachment_add_url', {
|
||||
this.do_action("document_url.action_ir_attachment_add_url", {
|
||||
additional_context: {
|
||||
'active_id': this.currentResID,
|
||||
'active_ids': [this.currentResID],
|
||||
'active_model': this.currentResModel,
|
||||
active_id: this.currentResID,
|
||||
active_ids: [this.currentResID],
|
||||
active_model: this.currentResModel,
|
||||
},
|
||||
on_close: this._onAddedUrl.bind(this),
|
||||
});
|
||||
},
|
||||
_onAddedUrl: function () {
|
||||
this.trigger_up('reload_attachment_box');
|
||||
_onAddedUrl: function() {
|
||||
this.trigger_up("reload_attachment_box");
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!-- Copyright 2018 Tecnativa - Ernesto Tejeda
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||
<templates id="template" xml:space="preserve">
|
||||
|
||||
<t t-extend="mail.chatter.AttachmentBox">
|
||||
<t t-jquery="span.o_upload_attachments_button" t-operation="after">
|
||||
<span class="btn btn-link o_add_url_button"><span class="fa fa-plus-square"/> Add URL</span>
|
||||
<span class="btn btn-link o_add_url_button"><span
|
||||
class="fa fa-plus-square"
|
||||
/> Add URL</span>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
|
@ -1,37 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<template id="assets_backend" name="google_drive assets" inherit_id="web.assets_backend">
|
||||
<template
|
||||
id="assets_backend"
|
||||
name="google_drive assets"
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<xpath expr="." position="inside">
|
||||
<script type="text/javascript" src="/document_url/static/src/js/url.js"></script>
|
||||
<script type="text/javascript" src="/document_url/static/src/js/url.js" />
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<record model='ir.actions.act_window' id='action_ir_attachment_add_url'>
|
||||
<field name='name'>Add URL</field>
|
||||
<field name='res_model'>ir.attachment.add_url</field>
|
||||
<field name='type'>ir.actions.act_window</field>
|
||||
<field name='target'>new</field>
|
||||
<field name='view_type'>form</field>
|
||||
<field name='view_mode'>form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_ir_attachment_add_url_form">
|
||||
<field name="name">ir.attachment.add_url.form</field>
|
||||
<field name="model">ir.attachment.add_url</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Add URL">
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="url" widget="url"/>
|
||||
<field name="name" />
|
||||
<field name="url" widget="url" />
|
||||
</group>
|
||||
<footer>
|
||||
<button name="action_add_url" string="Add" class="oe_highlight" type="object" />
|
||||
<button
|
||||
name="action_add_url"
|
||||
string="Add"
|
||||
class="oe_highlight"
|
||||
type="object"
|
||||
/>
|
||||
or
|
||||
<button special="cancel" string="Cancel" class="oe_link" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
|
||||
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
|
||||
# Copyright 2014 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
|
||||
from . import document_url
|
||||
|
@ -1,12 +1,12 @@
|
||||
# Copyright 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
|
||||
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
|
||||
# Copyright 2014 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2020 Tecnativa - Manuel Calero
|
||||
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
|
||||
from urllib import parse
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AddUrlWizard(models.Model):
|
||||
class AddUrlWizard(models.TransientModel):
|
||||
_name = "ir.attachment.add_url"
|
||||
_description = "Wizard to add URL attachment"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user