[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 FernandoRomera
parent 1f8c867c7d
commit 52301df2dc
10 changed files with 195 additions and 90 deletions

View File

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

View File

@@ -1,12 +1,23 @@
openerp.document_url = function(instance, m) {
var _t = instance.web._t,
QWeb = instance.web.qweb;
/* © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* © 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() {
var self = this;
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.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) {
if (!this.dialog) {
options.on_close();
}
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();
},
});
};
});

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<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>
</templates>