[MIG] from 8.0 to 9.0 document_url (#89)

[MIG] document_url

* bump version to 9.0.1.0.0 and make it installable
* Update JS structure
* Add css in order to be compliant with odoo style
* Add a README.rst and OCA conventions
* Improve selector
* add fr.po for fr translation
* open link with target='_blank'
This commit is contained in:
Jonathan Nemry (ACSONE) 2016-08-10 12:20:30 +02:00 committed by Pedro M. Baeza
parent 18d3cd9793
commit 073db63832
10 changed files with 195 additions and 90 deletions

63
document_url/README.rst Normal file
View File

@ -0,0 +1,63 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
==============
URL attachment
==============
Module that allows to attach an URL as a document.
Installation
============
To install this module, you need to click on install
Usage
=====
To use this module, you need to:
* go to menu more and click on add an url.
* Insert name and url into the wizard.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/118/9.0
For further information, please visit:
* https://www.odoo.com/forum/help-1
Known issues / Roadmap
======================
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/knowledge/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
`here <https://github.com/OCA/knowledge/issues/new?body=module:%20document_url%0Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Jonathan Nemry <jonathan.nemry@acsone.eu>
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

View File

@ -1,22 +1,5 @@
# -*- encoding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## # © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> # Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# # © 2016 ACSONE SA/NV (<http://acsone.eu>)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import wizard from . import wizard

View File

@ -1,28 +1,10 @@
# -*- encoding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## # © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> # Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# # © 2016 ACSONE SA/NV (<http://acsone.eu>)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{ {
'name': 'URL attachment', 'name': 'URL attachment',
'version': '8.0.1.0.0', 'version': '9.0.1.0.0',
'category': 'Tools', 'category': 'Tools',
'description': """ 'description': """
Module that allows to attach an URL as a document. Module that allows to attach an URL as a document.
@ -40,5 +22,5 @@ Module that allows to attach an URL as a document.
'qweb': [ 'qweb': [
'static/src/xml/url.xml', 'static/src/xml/url.xml',
], ],
'installable': False, 'installable': True,
} }

95
document_url/i18n/fr.po Normal file
View File

@ -0,0 +1,95 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * document_url
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-15 09:24+0000\n"
"PO-Revision-Date: 2016-03-15 09:24+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: document_url
#: model:ir.ui.view,arch_db:document_url.view_ir_attachment_add_url_form
msgid "Add"
msgstr "Ajouter"
#. module: document_url
#: model:ir.actions.act_window,name:document_url.action_ir_attachment_add_url
#: model:ir.ui.view,arch_db:document_url.view_ir_attachment_add_url_form
msgid "Add URL"
msgstr "Ajouter URL"
#. module: document_url
#. openerp-web
#: code:addons/document_url/static/src/xml/url.xml:4
#, python-format
msgid "Add URL..."
msgstr "Ajouter URL..."
#. module: document_url
#: model:ir.ui.view,arch_db:document_url.view_ir_attachment_add_url_form
msgid "Cancel"
msgstr "Annuler"
#. module: document_url
#: model:ir.model.fields,field_description:document_url.field_ir_attachment_add_url_create_uid
msgid "Created by"
msgstr "Créé par"
#. module: document_url
#: model:ir.model.fields,field_description:document_url.field_ir_attachment_add_url_create_date
msgid "Created on"
msgstr "Créé le"
#. module: document_url
#: model:ir.model.fields,field_description:document_url.field_ir_attachment_add_url_display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: document_url
#: model:ir.model.fields,field_description:document_url.field_ir_attachment_add_url_id
msgid "ID"
msgstr "ID"
#. module: document_url
#: model:ir.model.fields,field_description:document_url.field_ir_attachment_add_url___last_update
msgid "Last Modified on"
msgstr "Dernière modification le"
#. module: document_url
#: model:ir.model.fields,field_description:document_url.field_ir_attachment_add_url_write_uid
msgid "Last Updated by"
msgstr "Mis à jour par"
#. module: document_url
#: model:ir.model.fields,field_description:document_url.field_ir_attachment_add_url_write_date
msgid "Last Updated on"
msgstr "Mis à jour le"
#. module: document_url
#: model:ir.model.fields,field_description:document_url.field_ir_attachment_add_url_name
msgid "Name"
msgstr "Nom"
#. module: document_url
#: model:ir.model.fields,field_description:document_url.field_ir_attachment_add_url_url
msgid "URL"
msgstr "URL"
#. module: document_url
#: model:ir.model,name:document_url.model_ir_attachment_add_url
msgid "ir.attachment.add_url"
msgstr "ir.attachment.add_url"
#. module: document_url
#: model:ir.ui.view,arch_db:document_url.view_ir_attachment_add_url_form
msgid "or"
msgstr "ou"

View File

@ -0,0 +1,3 @@
.oe_url_attachment{
padding: 3px 20px;
}

View File

@ -1,12 +1,23 @@
openerp.document_url = function(instance, m) { /* © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
var _t = instance.web._t, * Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
QWeb = instance.web.qweb; * © 2016 ACSONE SA/NV (<http://acsone.eu>)
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/
odoo.define('document_url', function(require) {
instance.web.Sidebar.include({ var core = require('web.core');
var Sidebar = require('web.Sidebar');
var ActionManager = require('web.ActionManager');
var _t = core._t,
QWeb = core.qweb;
Sidebar.include({
redraw: function() { redraw: function() {
var self = this; var self = this;
this._super.apply(this, arguments); this._super.apply(this, arguments);
self.$el.find('.oe_sidebar_add_attachment').after(QWeb.render('AddUrlDocumentItem', {widget: self})) self.$el.find("a[href]").attr('target', '_blank');
self.$el.find('.oe_sidebar_add_attachment, .o_sidebar_add_attachment').after(QWeb.render('AddUrlDocumentItem', {widget: self}))
self.$el.find('.oe_sidebar_add_url').on('click', function (e) { self.$el.find('.oe_sidebar_add_url').on('click', function (e) {
self.on_url_doc(); self.on_url_doc();
}); });
@ -31,15 +42,15 @@ openerp.document_url = function(instance, m) {
}, },
}); });
instance.web.ActionManager = instance.web.ActionManager.extend({ ActionManager = ActionManager.include({
ir_actions_act_close_wizard_and_reload_view: function (action, options) { ir_actions_act_close_wizard_and_reload_view: function (action, options) {
if (!this.dialog) { if (!this.dialog) {
options.on_close(); options.on_close();
} }
this.dialog_stop(); this.dialog_stop();
this.inner_widget.views[this.inner_widget.active_view].controller.reload(); this.inner_widget.views[this.inner_widget.active_view.type].controller.reload();
return $.when(); return $.when();
}, },
}); });
}; });

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve"> <templates id="template" xml:space="preserve">
<t t-name="AddUrlDocumentItem"> <t t-name="AddUrlDocumentItem">
<li class="oe_sidebar_add_url"><span><b>Add URL...</b></span></li> <li class="oe_sidebar_add_url"><span class="oe_url_attachment">Add URL...</span></li>
</t> </t>
</templates> </templates>

View File

@ -4,6 +4,7 @@
<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"> <xpath expr="." position="inside">
<link rel="stylesheet" href="/document_url/static/src/css/url.css" type="text/css"/>
<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"></script>
</xpath> </xpath>
</template> </template>

View File

@ -1,22 +1,5 @@
# -*- encoding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## # © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> # Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# # © 2016 ACSONE SA/NV (<http://acsone.eu>)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import document_url from . import document_url

View File

@ -1,23 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## # © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
#
# Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> # Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# # © 2016 ACSONE SA/NV (<http://acsone.eu>)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import fields, orm from openerp.osv import fields, orm
try: try:
# Python 3 # Python 3