[MIG] document_url: Migration to 12.0

[UPD] README.rst

[UPD] Update document_url.pot

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: knowledge-12.0/knowledge-12.0-document_url
Translate-URL: https://translation.odoo-community.org/projects/knowledge-12-0/knowledge-12-0-document_url/

[UPD] README.rst
This commit is contained in:
ernesto
2019-04-25 15:07:56 -04:00
committed by Víctor Martínez
parent d0a4b66b65
commit 3f68cb106e
80 changed files with 1297 additions and 1593 deletions

View File

@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>URL attachment</title>
<style type="text/css">
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/knowledge/tree/11.0/document_url"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/knowledge-11-0/knowledge-11-0-document_url"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/118/11.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/knowledge/tree/12.0/document_url"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/knowledge-12-0/knowledge-12-0-document_url"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/118/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>Module that allows to attach an URL as a document.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
@@ -385,17 +385,21 @@ ul.auto-toc {
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<p>To use this module, you need to:</p>
<ul class="simple">
<li>go to menu more and click on add an url.</li>
<li>Insert name and url into the wizard.</li>
</ul>
<ol class="arabic simple">
<li>Open the form view of an object (Example: Customer Invoice INV/2019/0007).</li>
<li>Go to the chatter and click on the attached icon.</li>
<li>Click <strong>Add URL</strong> link.</li>
<li>Fill the wizard fields and click on Add button.</li>
<li>You will see a new <strong>URL attachment</strong> in the set of attachments related to
the object.</li>
</ol>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/knowledge/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/knowledge/issues/new?body=module:%20document_url%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/knowledge/issues/new?body=module:%20document_url%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -424,7 +428,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/11.0/document_url">OCA/knowledge</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/12.0/document_url">OCA/knowledge</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@@ -1,76 +1,39 @@
/* 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 2019 Tecnativa - Ernesto Tejeda
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/
odoo.define('document_url', function (require) {
"use strict";
var core = require('web.core');
var Sidebar = require('web.Sidebar');
var ActionManager = require('web.ActionManager');
var Context = require('web.Context');
var pyeval = require('web.pyeval');
var AttachmentBox = require('mail.AttachmentBox');
var _t = core._t,
QWeb = core.qweb;
Sidebar.include({
_redraw: function () {
var self = this;
this._super.apply(this, arguments);
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('.o_sidebar_add_url').on('click', function (e) {
self.on_url_doc();
AttachmentBox.include({
events: _.extend(AttachmentBox.prototype.events, {
"click span.o_add_url_button": "_onAddUrl",
}),
/**
* Opens wizard to add an URL attachment to the current record
*
* @private
* @param {MouseEvent} ev
*/
_onAddUrl: function (ev) {
this.do_action('document_url.action_ir_attachment_add_url', {
additional_context: {
'active_id': this.currentResID,
'active_ids': [this.currentResID],
'active_model': this.currentResModel,
},
on_close: this._onAddedUrl.bind(this),
});
},
on_url_doc: function (event) {
var self = this;
var env = self.env;
var view = self.getParent();
var ids = self.env.activeIds;
if (!_.isEmpty(ids)) {
var activeIdsContext = {
active_id: env.activeIds[0],
active_ids: env.activeIds,
active_model: env.model,
};
if (env.domain) {
activeIdsContext.active_domain = env.domain;
}
var context = new Context(env.context, activeIdsContext);
context = pyeval.eval('context', context);
self._rpc({
route: "/web/action/load",
params: {
action_id: "document_url.action_ir_attachment_add_url",
context: context,
},
}).done(function (result) {
self.getParent().do_action(result, {
additional_context: {
'active_ids': ids,
'active_id': [ids[0]],
'active_model': env.model,
},
});
});
}
},
/**
* @private
*/
_onAddedUrl: function () {
this.trigger_up('reload_attachment_box');
}
});
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.type].controller.reload();
return $.when();
},
});
});

View File

@@ -1,9 +0,0 @@
.o_cp_sidebar {
.o_sidebar_add_url span {
padding: 3px 25px;
color: @btn-default-color;
}
.o_sidebar_add_url:hover {
background-color: @table-bg-hover;
}
}

View File

@@ -1,8 +1,12 @@
<?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-name="AddUrlDocumentItem">
<li class="o_sidebar_add_url">
<span>Add URL...</span>
</li>
<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>
</t>
</t>
</templates>