Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9.0 cmis field #3

Closed
wants to merge 125 commits into from
Closed
Show file tree
Hide file tree
Changes from 120 commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
cc8d79a
Add connector dependencies
Sep 2, 2014
e2e8e1e
Add cmis dependency
Sep 2, 2014
4c0747d
[ADD] add cmis module: It allows to configure a CMIS backend in OpenERP
ehdem Mar 21, 2014
f1bf89b
[IMP] add the good version for cmislib and add the external_dependencies
ehdem Apr 1, 2014
f4123db
[IMP] add the good version
ehdem Apr 1, 2014
3c5e03e
[IMP] Check the permission when reading or writing doc
ehdem Apr 16, 2014
55a4d13
[IMP] Add good version of cmis
ehdem Apr 30, 2014
8f05562
[IMP] Change cmis version and add popup message we get issue if the c…
ehdem Apr 30, 2014
b383b50
[IMP] Add / as default value for Initial directory of read and Initia…
ehdem Apr 30, 2014
01eac37
[IMP] take Comments from LP
ehdem May 5, 2014
1d59765
[IMP] Fixed comments from LP, modify check_directory_of_write,check_d…
ehdem May 13, 2014
76d0a81
[FIX] Set CMIS in upper case in the interface
May 13, 2014
ce1f733
[IMp] updated test files
ehdem May 13, 2014
9d870dc
[IMP] Change the form view,add two booleans fields to check the write…
ehdem May 27, 2014
76e663c
[IMP] Check if alfresco server is down
ehdem May 28, 2014
976a87a
[IMP]Add functions for manage input filename and cmis query
ehdem Jun 12, 2014
10f4860
Clean-up
Sep 2, 2014
8b00a0b
[FIX] Rename backend's view
ehdem Sep 10, 2014
62451da
Fix typo
Sep 10, 2014
2fc01ff
[FIX] Fix error when you add ou search document
ehdem Sep 10, 2014
9ceb685
[FIX]Update form view for backend
ehdem Sep 11, 2014
551efd3
[FIX] Manage multi-backend
ehdem Sep 11, 2014
05a1619
Merge pull request #4 from savoirfairelinux/connector
Nov 8, 2014
de845c7
Remove dead xml
Feb 9, 2015
190ee98
Merge pull request #2 from savoirfairelinux/cmis
Feb 13, 2015
c8e8c74
Add OCA as author of OCA addons
gurneyalex Mar 2, 2015
dfe6b2a
[ADD] add cmis_write: It allows to create docs from OE in DMS
ehdem Mar 21, 2014
ade0cf0
[IMP] fix pep8 error, add control when writting from OE
ehdem Apr 16, 2014
769d46e
[IMP] fix bug when we create job with session
ehdem Apr 16, 2014
9ed6999
[IMP] Take comments from LP
ehdem May 5, 2014
4ae90ba
[IMP] Change the module description
ehdem May 6, 2014
2cfdd92
[IMP] FIxed comments from LP, added unittests,fix pep8 errors
ehdem May 13, 2014
e898a77
[IMP] update test file
ehdem May 13, 2014
b544ae5
[IMP] update the create_doc_in_edm function
ehdem May 27, 2014
3c46d83
[IMP] Download document from DMS
ehdem May 29, 2014
8b195ff
[FIX] Fix pep8 errors
ehdem Sep 10, 2014
10395c9
[FIX] Manage multi-backend
ehdem Sep 11, 2014
a20356f
don't use travis container-based infrastructure
gurneyalex Mar 27, 2015
4fd111c
[UPD] Improve the code
ehdem Mar 31, 2015
3977a4c
[UPD] Update translation
ehdem Mar 31, 2015
a1ec0a8
[UPD] Update unittests
ehdem Apr 1, 2015
030df9e
[UPD] Access the document and model
ehdem Apr 2, 2015
6b296c5
[UPD] Download document
ehdem Apr 2, 2015
a54490d
[UPD] Popup message display 2 times
ehdem Apr 2, 2015
3ca7e98
[FIX]Fix travis error
ehdem Apr 2, 2015
6ceddf8
[UPD] Change OpenERP term
ehdem Apr 7, 2015
fad1d85
[UPD] Add permissions for ir_attachment_doc_backend model
ehdem Apr 9, 2015
b043dcd
[UPD] Remove type field: It is deprecated
ehdem Apr 9, 2015
b45b463
[UPD] Save the document from DMS
ehdem Apr 14, 2015
d469e46
[UPD] Use connector unit
ehdem Apr 27, 2015
9596ff9
[UPD] Catch error when creatin document from Odoo
ehdem Apr 27, 2015
8256edf
[FIX] Fix flake8 error
ehdem Apr 27, 2015
61fa82c
Update travis configuration
gurneyalex May 14, 2015
5444df8
Update travis configuration
gurneyalex May 14, 2015
beb53b4
Update travis configuration
gurneyalex Jul 24, 2015
26081d5
[ADD] addons table in README.md
sbidoul Sep 23, 2015
2f5c4f5
[UPD] Use connector unit
ehdem Apr 27, 2015
571e68f
[FIX] Pylint errors. Update CI conf
Nov 14, 2015
3b5edc0
[FIX] Typo
Nov 14, 2015
98b13ef
[IMP] Activate Transifex
Nov 14, 2015
3964b8b
Merge pull request #7 from savoirfairelinux/7.0_connector_cmis
Nov 14, 2015
b66dacf
[ADD] add cmis_read module;It allows to allows you to use the CMIS ba…
ehdem Mar 21, 2014
1103f1d
[FIX] Duplicate xml record id. No UTF-8 coding comment.
Nov 14, 2015
3d266dd
[ADD] README.rst
Nov 17, 2015
098bbf6
OCA Transbot updated translations from Transifex
oca-transbot Nov 18, 2015
8e05c18
Merge pull request #1 from savoirfairelinux/cmis_read
Jan 23, 2016
b8bbb99
Merge pull request #3 from savoirfairelinux/cmis_write
Jan 26, 2016
ca04649
[FIX] PEP8 error
Jan 26, 2016
99639ef
[MIG] Make modules uninstallable
lmignon Feb 3, 2016
b45f5a9
[MIG] Update metafiles
lmignon Feb 3, 2016
5a1fa7d
[UPD] addons table in README.md
OCA-git-bot Feb 4, 2016
b8d733c
[ADD] setup.py
OCA-git-bot Apr 14, 2016
4a2a842
[FIX] remove en.po that was erroneously created by transbot
sbidoul Aug 15, 2016
37e0ea5
[MIG] Make modules installable
lmignon Feb 16, 2016
36bb193
[MIG] Remove deprecated checks attribute in test module
lmignon Feb 16, 2016
884a861
[MIG] Remove deprecated call to install_in_connector()
lmignon Feb 16, 2016
65ff8cd
[MIG] Move description to README.rst
lmignon Feb 16, 2016
451eb9e
[MIG] Use shortened licence
lmignon Feb 16, 2016
a221fa2
[MIG] Use new API
lmignon Feb 16, 2016
08ba662
[MIG] Move Odoo models to module 'models'
lmignon Feb 16, 2016
7b5d610
[MIG] Fix import after move of Odoo models to module models
lmignon Feb 16, 2016
1039035
[PEP8]
lmignon Feb 16, 2016
8c3692d
[FIX] connector.Environment replaced by connector.ConnectoEnvironment…
lmignon Feb 29, 2016
147d9a5
[FIX] ImportSynchonizer renamed to Importer in 9.0
lmignon Feb 29, 2016
7b3af94
[FIX] Import ACLs
lmignon Apr 7, 2016
7e353f1
[IMP] Rename backend_id to cmis_backend_id:wq
lmignon Apr 18, 2016
6afb766
[IMP] Use enhanced version of cmislib
lmignon Apr 18, 2016
22cfcb4
[FIX] base.group_document_user no more exists in V9
lmignon Apr 18, 2016
d6139b7
[FIX] cmis_write is not migrated
lmignon Apr 18, 2016
6e1b4f7
[FIX] In alfresco 5.1, cmis:path is a list
lmignon May 25, 2016
ad102d9
[MIG] Make module installable
lmignon Feb 17, 2016
594972a
[MIG] Move Odoo models to module 'models' and views to to folder 'views'
lmignon Feb 17, 2016
5b734a1
[MIG]Fix import after move
lmignon Feb 17, 2016
4a21856
[MIG] Use shortened licence
lmignon Feb 17, 2016
b06ccf0
[MIG] remove deprecated checks attribute in test module
lmignon Feb 17, 2016
a949883
[MIG] import order
lmignon Feb 17, 2016
1d44535
[MIG] move description to README.rst
lmignon Feb 17, 2016
26bda64
[MIG] Use new API
lmignon Feb 17, 2016
447b36e
[MIG] Use new API
lmignon Feb 18, 2016
218261a
[IMP]Only store attachment linked to a model in cmis
lmignon Feb 18, 2016
c630be1
[IMP] Rename backend_id to cmis_backend_id
lmignon Apr 18, 2016
11dc878
[PEP8]
lmignon Apr 18, 2016
ce190b6
[MIG] make cmis_write installable
lmignon Apr 18, 2016
7b1686a
[IMP] Add abstract models for mixed content between Odoo and Alfresco
lmignon Feb 19, 2016
a4eca73
[IMP] Better function naming
lmignon Feb 21, 2016
c106391
[FIX] Improve logic
lmignon Feb 26, 2016
68c1240
[FIX] Disable SSL certificat validation
lmignon Mar 9, 2016
b477fb6
FIX
lmignon Mar 9, 2016
640a882
[IMP] Add a more explicit error message when checking the CMIS paramt…
lmignon Mar 10, 2016
9fc6b25
[FIX] Remove field name on cmis.folder
lmignon Mar 16, 2016
cce4311
[IMP] Add computed field to get the name of the cmis folder to create
lmignon Mar 16, 2016
e08dee3
[IMP] Modularity: allow to specify properties to use when creating a …
lmignon Mar 17, 2016
e30eb69
[IMP] Rename backend_id to cmis_backend_id
lmignon Apr 18, 2016
51f3315
[PEP8]
lmignon Apr 18, 2016
7bf3843
[IMP] Avoid searching for all folder paths to check if a path exists
lmignon May 27, 2016
19f3739
Remove reference to read direcrtory
lmignon Jun 21, 2016
25ce644
[ADD] setup.py
lmignon Aug 2, 2016
a27e8ef
[FIX] Constains definition
lmignon Aug 24, 2016
3cfbd0f
first implementation of field.CmisFolder
lmignon Aug 31, 2016
ecbe9d8
Add http controller that can be used by the UI to initialize the valu…
lmignon Sep 1, 2016
d7421a5
Improve CmisFolder field API
lmignon Sep 4, 2016
9edc5de
Improve modularity
lmignon Sep 4, 2016
f8912b8
Fix controller: The response is wrapped by the decorator
lmignon Sep 5, 2016
aea49bd
Fix cmis.backend._clear_caches
lmignon Sep 5, 2016
e6f127f
Remove fields moved to its own module
lmignon Sep 7, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 23 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
language: python
sudo: false
cache:
apt: true
directories:
- $HOME/.cache/pip

python:
- "2.7"

addons:
apt:
packages:
- expect-dev # provides unbuffer utility
- python-lxml # because pip installation is slow

env:
- VERSION="7.0" ODOO_REPO="odoo/odoo"
- VERSION="7.0" ODOO_REPO="OCA/OCB"
global:
- VERSION="9.0" TESTS="0" LINT_CHECK="0" TRANSIFEX="0"
- TRANSIFEX_USER='transbot@odoo-community.org'
- secure: GqSJ+5RSD8NzbHpWCGZ8mgIV2gCydxcfZq0pWkFEORUBcIEEwSlEvzlInwvaLTkuVKnQMQiwoM9ihg7v5Yl5NaizyNVIRvHuaXsKuBtn+i2YKmg/dp1NOsguWtHIPvWBCUC5CzG2zDkN/rU3N6lVquDUxsuz6NceNPtl2yq3PxQ=

matrix:
- LINT_CHECK="1"
- TRANSIFEX="1"
- TESTS="1" ODOO_REPO="odoo/odoo"
- TESTS="1" ODOO_REPO="OCA/OCB"

virtualenv:
system_site_packages: true
Expand All @@ -14,10 +33,10 @@ install:
- git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- travis_install_nightly
- pip install git+https://github.com/lmignon/python-cmislib.git@6.0.dev#egg=cmislib

script:
- travis_run_flake8
- travis_run_tests

after_success:
coveralls
- travis_after_tests_success
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
[![Build Status](https://travis-ci.org/OCA/connector-cmis.svg?branch=7.0)](https://travis-ci.org/OCA/connector-cmis)
[![Coverage Status](https://coveralls.io/repos/OCA/connector-cmis/badge.png?branch=7.0)](https://coveralls.io/r/OCA/connector-cmis?branch=7.0)
[![Build Status](https://travis-ci.org/OCA/connector-cmis.svg?branch=9.0)](https://travis-ci.org/OCA/connector-cmis)
[![Coverage Status](https://coveralls.io/repos/OCA/connector-cmis/badge.png?branch=9.0)](https://coveralls.io/r/OCA/connector-cmis?branch=9.0)

Connector-cmis
==============

[//]: # (addons)
Unported addons
---------------
addon | version | summary
--- | --- | ---
[cmis](cmis/) | 7.0.1.1.0 (unported) | Connect OpenERP with a CMIS server
[cmis_read](cmis_read/) | 7.0.1.0.0 (unported) | Store Document File from a Remote CMIS Server
[cmis_write](cmis_write/) | 7.0.0.1.0 (unported) | Create Document in DMS from Odoo/OpenERP

[//]: # (end addons)


Translation Status
------------------
[![Transifex Status](https://www.transifex.com/projects/p/OCA-connector-cmis-9-0/chart/image_png)](https://www.transifex.com/projects/p/OCA-connector-cmis-9-0)
74 changes: 74 additions & 0 deletions cmis/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
.. 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

==============
CMIS Connector
==============

This module is the base for Odoo modules implementing different integration
scenario with a CMIS server.
It allows you to configure a CMIS backend in Odoo.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: document CmisFolder when it is stable.


Installation
============

To be compliant with the latest version of CMIS (1.1), the connector use
the latest version of the python cmislib library not yet released at this
stage. The lib can be installed with:

pip install svn+https://svn.apache.org/repos/asf/chemistry/cmislib/trunk#egg=cmislib

Configuration
=============

Create a new CMIS backend with the host, login and password.

Usage
=====

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/104/9.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/connector-cmis/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
<https://github.com/OCA/
connector-cmis/issues/new?body=module:%20
cmis%0Aversion:%20
9.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

Contributors
------------

* El Hadji Dem <elhadji.dem@savoirfairelinux.com>
* Maxime Chambreuil <maxime.chambreuil@savoirfairelinux.com>
* Laurent Mignon <laurent.mignon@acsone.eu>

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.
14 changes: 14 additions & 0 deletions cmis/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
# © 2014-2015 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
import httplib2
import functools
from . import models
from . import controllers

logger = logging.getLogger(__name__)

logger.warning('Disable SSL Certificate Validation by python code')
httplib2.Http = functools.partial(
httplib2.Http, disable_ssl_certificate_validation=True)
24 changes: 24 additions & 0 deletions cmis/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# © 2014-2015 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
'name': 'CMIS',
'version': '9.0.1.0.0',
'category': 'Connector',
'summary': 'Connect OpenERP with a CMIS server',
'author': "Savoir-faire Linux, "
"ACSONE SA/NV, "
"Odoo Community Association (OCA)",
'website': 'https://odoo-community.org/',
'license': 'AGPL-3',
'external_dependencies': {
'python': ['cmislib'],
},
'data': [
'security/cmis_backend.xml',
'views/cmis_menu.xml',
'views/cmis_backend.xml',
],
'installable': True,
}
1 change: 1 addition & 0 deletions cmis/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
20 changes: 20 additions & 0 deletions cmis/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
import json
import werkzeug
from openerp import http
from openerp.addons.web.controllers import main


class CmisController(http.Controller):

@http.route('/web/cmis/field/init_value', type='json', methods=['POST'],
auth="user")
@main.serialize_exception
def init_field_value(self, model_name, res_id, field_name):
model_inst = http.request.env[model_name].browse(int(res_id))
value = model_inst._fields[field_name].init_value(model_inst)
response = werkzeug.Response(json.dumps(
{'value': value}), mimetype='application/json')
return response
17 changes: 17 additions & 0 deletions cmis/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbidoul I wonder if it would be better to delete these exceptions and to use only those available in Odoo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which exceptions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those above...
CMISError -> UserError
CMISConnectionError -> don't catch the native exception

# © 2016 ACSONE SA/NV (<http://acsone.eu>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp.exceptions import UserError


class CMISError(UserError):
"""CMIS Error!"""
def __init__(self, value):
super(CMISError, self).__init__(value)


class CMISConnectionError(CMISError):
"""CMIS connection Error!"""
def __init__(self, value):
super(CMISConnectionError, self).__init__(value)
105 changes: 105 additions & 0 deletions cmis/fields.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# -*- coding: utf-8 -*-
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from operator import attrgetter
from openerp import fields
from openerp.exceptions import UserError


class CmisFolder(fields.Field):
""" A reference to a cmis:folder. The reference must be formatted as
follow: backend_name + ':' cmis:objectId

:param backend_name:

The attribute ``backend_name`` is mandatory

:param allow_create: (by default True)

:param allow_delete: (by default False)

:param cmis_create_method:

:param cmis_path: (by default backend.initial_directory_write + '/' model._name)

:param cmis_name_get: (by default instance.name_get)

"""
type = 'char' # Postgresl
widget = 'cmis_folder' # Web widget
_slots = {
'backend_name': None,
'cmis_name_get': 'name_get',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create_name_get ?

'allow_create': True,
'allow_delete': False,
'cmis_path': None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create_root_get ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a method too, since the most common override is changing the root.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbidoul
3 parameters can be passed to the cmis methot createFolder

  • the parent object id, (required)
  • the content name (required)
  • and a dict for properties (optional)

What do you think of the idea of having one parameter for each item

  • create_root_get
  • create_name_get
  • create_properties_get

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good idea.

'cmis_create_method': None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create_method ?

If create_root_get and create_name_get are method, this will rarely be used, but could be useful nevertheless.

}

def __init__(self, backend_name=None, string=None, **kwargs):
super(CmisFolder, self).__init__(
backend_name=backend_name, string=string, **kwargs)


def get_description(self, env):
""" Return a dictionary that describes the field ``self``. """
desc = super(CmisFolder, self).get_description(env)
desc['type'] = self.widget
return desc

_description_backend_name = property(attrgetter('backend_name'))

def init_value(self, record):
if record is None:
return self # the field is accessed through the owner class

env = record.env
if not record:
# null record -> return the null value for this field
return self.null(env)

self._check_null(record)

value = None
backend = env['cmis.backend'].get_by_name(name=self.backend_name)
if self.cmis_create_method:
fct = self.cmis_create_method
if not callable(fct):
fct = getattr(record, fct)
value = fct(backend)
else:
value = self._create_in_cmis(record, backend)
self.__set__(record, value)
return value

def _create_in_cmis(self, record, backend):
name = self._get_cmis_name(record)
path = self._get_cmis_path(record, backend)
#create
parent_cmis_object = backend.get_folder_by_path(
path, create_if_not_found=True)
repo = backend.get_cmis_repository()
new_folder = repo.createFolder(
parent_cmis_object, name)
return new_folder.getObjectId()

def _check_null(self, record, raise_exception=True):
val = self.__get__(record, record)
if val and raise_exception:
raise UserError('A value is already assigned to %s' % self)
return val

def _get_cmis_name(self, record):
if self.cmis_name_get == 'name_get':
return record.name_get()[0][1]
fct = self.cmis_name_get
if not callable(fct):
fct = getattr(record, fct)
return fct()

def _get_cmis_path(self, record, backend):
if self.cmis_path:
return self.cmis_path
else:
return '/'.join([backend.initial_directory_write,
record._name.replace('.', '_')])