[MIG] document_url: Migration to 13.0

This commit is contained in:
Manuel Calero 2020-03-11 11:01:29 +01:00 committed by Bhavesh Heliconia
parent 9260841adf
commit 7b35822534
9 changed files with 38 additions and 37 deletions

View File

@ -1,4 +1,4 @@
# Copyright 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com) # 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>) # Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
from . import wizard from . import wizard

View File

@ -1,15 +1,13 @@
# Copyright 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com) # Copyright 2014 Tecnativa - Pedro M. Baeza
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
# Copyright 2020 Tecnativa - Manuel Calero # Copyright 2020 Tecnativa - Manuel Calero
{ {
"name": "URL attachment", "name": "URL attachment",
"version": "13.0.1.0.0", "version": "13.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",
"license": "AGPL-3", "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"], "qweb": ["static/src/xml/url.xml"],
"installable": True, "installable": True,
} }

View File

@ -4,3 +4,4 @@
* Pedro M. Baeza * Pedro M. Baeza
* Ernesto Tejeda * Ernesto Tejeda
* Manuel Calero * Manuel Calero
* Víctor Martínez

View File

@ -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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_ir_attachment_add_url access_ir_attachment_add_url model_ir_attachment_add_url 1 1 1 1

View File

@ -5,28 +5,28 @@
* Copyright 2020 Tecnativa - Manuel Calero * Copyright 2020 Tecnativa - Manuel Calero
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). * 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"; "use strict";
var AttachmentBox = require('mail.AttachmentBox'); var AttachmentBox = require("mail.AttachmentBox");
AttachmentBox.include({ AttachmentBox.include({
events: _.extend(AttachmentBox.prototype.events, { events: _.extend(AttachmentBox.prototype.events, {
"click span.o_add_url_button": "_onAddUrl", "click span.o_add_url_button": "_onAddUrl",
}), }),
_onAddUrl: function () { _onAddUrl: function() {
// Opens wizard to add an URL attachment to the current record // 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: { additional_context: {
'active_id': this.currentResID, active_id: this.currentResID,
'active_ids': [this.currentResID], active_ids: [this.currentResID],
'active_model': this.currentResModel, active_model: this.currentResModel,
}, },
on_close: this._onAddedUrl.bind(this), on_close: this._onAddedUrl.bind(this),
}); });
}, },
_onAddedUrl: function () { _onAddedUrl: function() {
this.trigger_up('reload_attachment_box'); this.trigger_up("reload_attachment_box");
}, },
}); });
}); });

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2018 Tecnativa - Ernesto Tejeda <!-- Copyright 2018 Tecnativa - Ernesto Tejeda
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<templates id="template" xml:space="preserve"> <templates id="template" xml:space="preserve">
<t t-extend="mail.chatter.AttachmentBox"> <t t-extend="mail.chatter.AttachmentBox">
<t t-jquery="span.o_upload_attachments_button" t-operation="after"> <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>
</t> </t>
</templates> </templates>

View File

@ -1,37 +1,41 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <odoo>
<template
<template id="assets_backend" name="google_drive assets" inherit_id="web.assets_backend"> id="assets_backend"
name="google_drive assets"
inherit_id="web.assets_backend"
>
<xpath expr="." position="inside"> <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> </xpath>
</template> </template>
<record model='ir.actions.act_window' id='action_ir_attachment_add_url'> <record model='ir.actions.act_window' id='action_ir_attachment_add_url'>
<field name='name'>Add URL</field> <field name='name'>Add URL</field>
<field name='res_model'>ir.attachment.add_url</field> <field name='res_model'>ir.attachment.add_url</field>
<field name='type'>ir.actions.act_window</field> <field name='type'>ir.actions.act_window</field>
<field name='target'>new</field> <field name='target'>new</field>
<field name='view_type'>form</field>
<field name='view_mode'>form</field> <field name='view_mode'>form</field>
</record> </record>
<record model="ir.ui.view" id="view_ir_attachment_add_url_form"> <record model="ir.ui.view" id="view_ir_attachment_add_url_form">
<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 name="action_add_url" string="Add" class="oe_highlight" type="object" /> <button
name="action_add_url"
string="Add"
class="oe_highlight"
type="object"
/>
or or
<button special="cancel" string="Cancel" class="oe_link" /> <button special="cancel" string="Cancel" class="oe_link" />
</footer> </footer>
</form> </form>
</field> </field>
</record> </record>
</odoo> </odoo>

View File

@ -1,4 +1,4 @@
# Copyright 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com) # 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>) # Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
from . import document_url from . import document_url

View File

@ -1,12 +1,12 @@
# Copyright 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com) # Copyright 2014 Tecnativa - Pedro M. Baeza
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> # Copyright 2020 Tecnativa - Manuel Calero
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>) # Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
from urllib import parse from urllib import parse
from odoo import fields, models from odoo import fields, models
class AddUrlWizard(models.Model): class AddUrlWizard(models.TransientModel):
_name = "ir.attachment.add_url" _name = "ir.attachment.add_url"
_description = "Wizard to add URL attachment" _description = "Wizard to add URL attachment"