Skip to content

Commit

Permalink
Merge abf35a8 into a20356f
Browse files Browse the repository at this point in the history
  • Loading branch information
bwrsandman committed Apr 13, 2015
2 parents a20356f + abf35a8 commit 0c6f296
Show file tree
Hide file tree
Showing 14 changed files with 760 additions and 0 deletions.
23 changes: 23 additions & 0 deletions cmis_read/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# 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
73 changes: 73 additions & 0 deletions cmis_read/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# 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': 'CMIS Read',
'version': '0.1',
'category': 'Knowledge Management',
'summary': 'Store Document File in a Remote CMIS Server',
'description': """
This module allows you to use the CMIS backend to search in the DMS repository
and attach documents to OpenERP records.
Configuration
=============
Create a new CMIS backend with the host, login and password.
Usage
=====
* On one OpenERP record, click "Add from DMS".
* Type your query and then click on "Search".
* Filter your results if necessary
* Select the documents you want to attach
* Selected documents will be enqueued for importing
Contributors
------------
* El Hadji Dem (elhadji.dem@savoirfairelinux.com)
""",
'author': 'Savoir-faire Linux',
'website': 'www.savoirfairelinux.com',
'license': 'AGPL-3',
'depends': [
'document',
'cmis'
],
'data': [
'security/ir.model.access.csv',
'wizard/ir_attachment_dms_wizard_view.xml',
'wizard/ir_attachment_dms_view.xml',
],
'js': [
'static/src/js/document.js'
],
'qweb': [
'static/src/xml/document.xml'
],
'test': [],
'demo': [
],
'installable': True,
'auto_install': False,
}
119 changes: 119 additions & 0 deletions cmis_read/i18n/cmis_read.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * cmis_read
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-03-21 14:55+0000\n"
"PO-Revision-Date: 2014-03-21 10:55-0500\n"
"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 1.5.4\n"

#. module: cmis_read
#: field:ir.attachment.dms,file_id:0
msgid "File ID"
msgstr ""

#. module: cmis_read
#: field:ir.attachment.dms.wizard,attachment_ids:0
msgid "Attachments"
msgstr ""

#. module: cmis_read
#: view:ir.attachment.dms.wizard:0
msgid "Search Document"
msgstr ""

#. module: cmis_read
#: field:ir.attachment.dms,name:0 help:ir.attachment.dms,name:0
#: field:ir.attachment.dms.wizard,name:0 help:ir.attachment.dms.wizard,name:0
msgid "File name"
msgstr ""

#. module: cmis_read
#: code:addons/cmis_read/wizard/document_wizard.py:59
#, python-format
msgid "You have to fill in the file name. And try again"
msgstr ""

#. module: cmis_read
#: help:ir.attachment.dms,file_id:0
msgid "File Id"
msgstr ""

#. module: cmis_read
#: model:_description:0 model:ir.model,name:cmis_read.model_ir_attachment_dms
msgid "ir.attachment.dms"
msgstr ""

#. module: cmis_read
#: field:ir.attachment.dms,owner:0 help:ir.attachment.dms,owner:0
msgid "Owner"
msgstr ""

#. module: cmis_read
#: view:ir.attachment.dms.wizard:0
msgid ""
"This action allows you to search by file name and to add the document you "
"select"
msgstr ""

#. module: cmis_read
#. openerp-web
#: code:addons/cmis_read/static/src/js/document.js:26
#, python-format
msgid "Search Document from DMS"
msgstr ""

#. module: cmis_read
#. openerp-web
#: code:addons/cmis_read/static/src/xml/document.xml:7
#, python-format
msgid "Add Doc from DMS..."
msgstr ""

#. module: cmis_read
#: code:addons/cmis_read/wizard/document_wizard.py:58
#: code:addons/cmis_read/wizard/document_wizard.py:86
#, python-format
msgid "Error"
msgstr ""

#. module: cmis_read
#: view:ir.attachment.dms.wizard:0
msgid "Cancel"
msgstr ""

#. module: cmis_read
#: view:ir.attachment.dms.wizard:0
msgid "Apply"
msgstr ""

#. module: cmis_read
#: model:_description:0
#: model:ir.model,name:cmis_read.model_ir_attachment_dms_wizard
msgid "ir.attachment.dms.wizard"
msgstr ""

#. module: cmis_read
#: view:ir.attachment.dms.wizard:0
msgid "Search"
msgstr ""

#. module: cmis_read
#: view:ir.attachment.dms.wizard:0
msgid "or"
msgstr ""

#. module: cmis_read
#: code:addons/cmis_read/wizard/document_wizard.py:87
#, python-format
msgid "You have to select at least 1 Document. And try again"
msgstr ""
2 changes: 2 additions & 0 deletions cmis_read/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_ir_attachment_dms_wizard,access_ir_attachment_dms_wizard,model_ir_attachment_dms_wizard,base.group_document_user,1,1,1,1
44 changes: 44 additions & 0 deletions cmis_read/static/src/js/document.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
openerp.cmis_read = function(instance, m) {
var _t = instance.web._t,
QWeb = instance.web.qweb;

instance.web.Sidebar.include({
redraw: function() {
var self = this;
this._super.apply(this, arguments);
self.$el.find('.oe_sidebar_add_attachment').after(QWeb.render('AddDocfromdms', {widget: self}))
self.$el.find('.oe_sidebar_add_dms_doc').on('click', function (e) {
self.on_cmis_doc();
});
},
on_cmis_doc: function(state) {
var self = this;
var view = self.getParent();
var ids = ( view.fields_view.type != "form" )? view.groups.get_selection().ids : [ view.datarecord.id ];
var ds = new instance.web.DataSet(this, 'ir.attachment', context);
// you can pass in other data using the context dictionary variable
var context = {
'model': view.dataset.model,
'ids': ids,
};
// the action dictionary variable sends data in the "self.do_action" method
var action = {
name: _t("Search Document from DMS"),
type: 'ir.actions.act_window',
res_model: 'ir.attachment.dms.wizard',
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
target: 'new',
context: context,
};
// self.do_action accepts the action parameter and opens the new view
self.do_action(action, {
// refresh list of documents
on_close: function () {
self.do_attachement_update(self.dataset, self.model_id);
}
});
}
});
};
10 changes: 10 additions & 0 deletions cmis_read/static/src/xml/document.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- vim:fdl=1:
-->
<templates id="template" xml:space="preserve">

<t t-name="AddDocfromdms">
<li class="oe_sidebar_add_dms_doc"><span><b>Add Doc from DMS...</b></span></li>
</t>

</templates>
31 changes: 31 additions & 0 deletions cmis_read/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# 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 (
test_ir_attachment_dms_wizard,
test_ir_attachment_dms,
)

checks = [
test_ir_attachment_dms_wizard,
test_ir_attachment_dms,
]
65 changes: 65 additions & 0 deletions cmis_read/tests/test_ir_attachment_dms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# 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.tests.common import TransactionCase


class test_ir_attachment_dms(TransactionCase):

def setUp(self):
super(test_ir_attachment_dms, self).setUp()
# Clean up registries
self.registry('ir.model').clear_caches()
self.registry('ir.model.data').clear_caches()
# Get registries
self.user_model = self.registry("res.users")
self.ir_attachment_dms_model = self.registry("ir.attachment.dms")
self.attachment_dms_wizard_model = self.registry(
"ir.attachment.dms.wizard")
# Get context
self.context = self.user_model.context_get(self.cr, self.uid)
vals_wizard = {
'name': 'TEST',
'attachment_ids': [(0, 0, {
'name': 'TEST',
'file_id': 1,
'selectable_ok': True,
})],
}
wizard_id = self.attachment_dms_wizard_model.create(
self.cr, self.uid, vals_wizard, context=self.context)
self.vals = {
'name': 'TEST',
'file_id': 1,
'wizard_id': wizard_id,
'selectable_ok': True,
}

def test_create_ir_attachment_dms(self):
cr, uid, vals, context = self.cr, self.uid, self.vals, self.context
attachment_dms_id = self.ir_attachment_dms_model.create(
cr, uid, vals, context=context)
attachment_dms_obj = self.ir_attachment_dms_model.browse(
cr, uid, attachment_dms_id, context=context)
self.assertEqual(attachment_dms_obj.name, vals['name'])
self.assertEqual(attachment_dms_obj.selectable_ok,
vals['selectable_ok'])

0 comments on commit 0c6f296

Please sign in to comment.