Skip to content

Commit

Permalink
Merge pull request #99 from acsone/9.0-dev
Browse files Browse the repository at this point in the history
Prepare new version
  • Loading branch information
lmignon authored Sep 11, 2018
2 parents 43a4b6a + 2a25e91 commit ed4e065
Show file tree
Hide file tree
Showing 83 changed files with 3,298 additions and 386 deletions.
48 changes: 32 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
sudo: false

cache: pip

addons:
apt:
packages:
- expect-dev # provides unbuffer utility
apt:
packages:
- expect-dev

language: python

python:
- "2.7"
- '2.7'

env:
global:
# travis for docs build
- secure: 1r8MhN8yvgC982brnDvNvxNpP5XAQjebBeX2lQBTCP2TFK1FXC1tBTlP7DIqgbFkO7UvVmyFb56S1UwyP2nz/dASvvVmIJtMBUpZPG21o5JLyHkfCK9EimbilVcxaQkJWTFD67GfaKYe3RNg7F+i36ymyWE6HrosnxbQFqIAVsOjPbGZPrNNVruIOToR6RVVpwC3A1qN6V777C5gwi+1CcI94FgBiQNzQhq9ghp87hq7ixzxbB+Ec0ucNFTr3jho4rdpy0r9EeWV/V+TZjFNrcYDmyYJ6nP8eP4QIvP5c8D2P0MLob+oH2EAjanUgKR5j0/fI/VbGhQy0NXjBp6918CLDru6fxQMYS8nCYTZ8/ZjsTPPp/e8Ts+cS09yFbSP3+sxGcFFmo3nE3P40KsT6e36BGpHQIZVbzjJ6gpBfN04H/5gqJbRwmkfjQQ36I4RCzs1fWdBA8EdNqLjxIDAgcg5hlA3xfIBRADs7y7Ak5mmwNfpDnn+yPKMnpnLTVnoWNWDBaLhRLCyBNTBEKljuic0J2KQdCXmgSDTroZ6QQ4OzmbMltujk6zao9WbQbx5U5j9HxVUQ6segCoU3PJgDWtmkbLrHuKkOmhk3vnlMjFdhVZZfDj3Lmp6t+lo1/XM7tKjOhjjdUDKD/bZX3vIacDrcUw1gqjxGm5pbU4s2Os=

before_install:
- pip install acsoo
Expand All @@ -23,23 +29,33 @@ jobs:
include:
- stage: test
env: FLAKE8=1
script:
- echo "Flake8 check $ADDONS_TEST"
- acsoo flake8
script:
- echo "Flake8 check $ADDONS_TEST"
- acsoo flake8
- stage: test
env: PYLINT=1
script:
- echo "Pylint check $ADDONS_TEST"
- acsoo pylint
- echo "Pylint check $ADDONS_TEST"
- acsoo pylint
- stage: test
env: ODOO=1
install:
- pip install -r requirements-test.txt
- pip install -r requirements-test.txt
script:
- echo "Installing $ADDONS_INST"
- unbuffer ${VIRTUAL_ENV}/bin/openerp-server -d ${DB_NAME} --stop-after-init -i ${ADDONS_INST} | acsoo checklog
- echo "Testing $ADDONS_TEST"
- unbuffer coverage run ${VIRTUAL_ENV}/bin/openerp-server -d ${DB_NAME} --stop-after-init -i ${ADDONS_TEST} --test-enable | acsoo checklog
- echo "Installing $ADDONS_INST"
- unbuffer ${VIRTUAL_ENV}/bin/openerp-server -d ${DB_NAME} --stop-after-init -i ${ADDONS_INST} | acsoo checklog
- echo "Testing $ADDONS_TEST"
- unbuffer coverage run ${VIRTUAL_ENV}/bin/openerp-server -d ${DB_NAME} --stop-after-init -i ${ADDONS_TEST} --test-enable | acsoo checklog
after_success:
- codecov

- codecov
- stage: deploy
if: branch = 10.0
env: BUILD_DOC=1
install:
- pip install -r requirements-test.txt
- pip install https://github.com/Syntaf/travis-sphinx/archive/master.tar.gz
- pip install sphinx-bootstrap-theme
script:
- travis-sphinx build -s doc/
after_success:
- travis-sphinx deploy -b 10.0 -c alfodoo.org
17 changes: 16 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
9.?.?.?.? (?)
~~~~~~~~~~~~~

* Fix: copy=False is now the default on CmisFolder fields.
* Improvement: Implement Checkin Checkout.
* Improvement: New addons cmis_web_proxy and cmis_web_proxy_alf. With these
addons, instead of using the actual user credentials for submitting
Odoo widget requests (CMIS) to Alfresco, a proxy user is used.
* Improvement: Handle name conflict on folder create.
A new parameter on the backend let's you choice between 2 strategies:
'error' or 'increment. If a folder already exists with the same name, the
system will raise an error if 'error' is specified as strategy (default)
otherwise a suffix is added to the name to make it unique.
* Fix: Into the JS Widget, The width of the dropdown menu for actions on nodes
properly fit the length of the action labels.
* Fix: Into the JS Widget, declare the charset used when information
are posted to CMIS.
* Fix: Refresh the document before downloading or opening it into alfresco
to always get the latest version. (issue #83)
* Fix: Display only the buttons in the main toolbar for which the user has the
appropriate permissions.
* Fix: JS error when multiple documents are uploaded at once.
Expand All @@ -9,7 +25,6 @@
9.0.2.0.0 (Oct, 17, 2017)
~~~~~~~~~~~~~~~~~~~~~~~~~

* Improvement: New document viewer.
* Improvement: Allow the preview of image files.
* Fix: Display the node title if set into the CMIS container.
* Fix: On the import document dialog, rename 'Create' button into 'Add'
Expand Down
2 changes: 1 addition & 1 deletion acsoo.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[pylint]
pylint-options=
--disable=locally-disabled
--disable=locally-disabled,unnecessary-utf8-coding-comment
2 changes: 1 addition & 1 deletion cmis_alf/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
:alt: License: AGPL-3

=================================
CMIS Connector Alfresco Extention
CMIS Connector Alfresco Extension
=================================

This module extend the CMIS connector with specifics functionalities provided by alfresco:
Expand Down
7 changes: 5 additions & 2 deletions cmis_alf/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
{
'name': 'CMIS for Alfresco',
'version': '9.0.2.0.0',
'category': 'Connector',
'summary': 'Alfresco extension for the CMIS Connector',
'category': 'Document Management',
'author': "ACSONE SA/NV",
'website': 'https://odoo-community.org/',
'website': 'http://alfodoo.org/',
'license': 'AGPL-3',
'depends': [
'cmis',
],
'data': [
'views/cmis_backend_view.xml',
],
'images': [
'static/description/main_icon.png',
],
'installable': True,
'auto_install': False,
}
Binary file added cmis_alf/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cmis_alf/static/description/main_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions cmis_field/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
'name': 'CMIS Fields',
'name': 'Alfodoo CMIS Field',
'version': '9.0.2.0.0',
'summary': 'Specialized field sto work with a CMIS server',
'summary': 'Specialized field to work with a CMIS server',
'category': 'Document Management',
'author': "ACSONE SA/NV ",
'website': 'https://alfodoo.org/',
'website': 'http://alfodoo.org/',
'license': 'AGPL-3',
'depends': [
'cmis'
Expand All @@ -16,4 +17,7 @@
'views/cmis_backend_view.xml'
],
'installable': True,
'images': [
'static/description/main_icon.png',
],
}
22 changes: 20 additions & 2 deletions cmis_field/fields/cmis_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .cmis_meta_field import CmisMetaField


# pylint:disable=property-on-old-class
# pylint:disable=property-on-old-class,invalid-metaclass
class CmisFolder(fields.Field):
""" A reference to a cmis:folder. (cmis:objectId)
Expand Down Expand Up @@ -71,7 +71,8 @@ class CmisFolder(fields.Field):
'create_parent_get': None,
'create_properties_get': None,
'allow_create': True,
'allow_delete': False
'allow_delete': False,
'copy': False, # noderef are not copied by default
}

__metaclass__ = CmisMetaField
Expand Down Expand Up @@ -111,6 +112,12 @@ def create_value(self, records):
"""
for record in records:
self._check_null(record)
if self.related:
self._create_value_related(records)
else:
self._create_value(records)

def _create_value(self, records):
backend = self.get_backend(records.env)
if self.create_method:
fct = self.create_method
Expand All @@ -120,6 +127,16 @@ def create_value(self, records):
return
self._create_in_cmis(records, backend)

def _create_value_related(self, records):
others = records.sudo() if self.related_sudo else records
for record, other in zip(records, others):
if not record.id and record.env != other.env:
# draft records: copy record's cache to other's cache first
fields.copy_cache(record, other.env)
other, field = self.traverse_related(other)
field.create_value(other)
record[self.name] = other[field.name]

def _create_in_cmis(self, records, backend):
names = self.get_create_names(records, backend)
parents = self.get_create_parents(records, backend)
Expand All @@ -132,6 +149,7 @@ def _create_in_cmis(self, records, backend):
else:
backend.is_valid_cmis_name(name, raise_if_invalid=True)
parent = parents[record.id]
name = backend.get_unique_folder_name(name, parent)
props = properties[record.id] or {}
value = repo.createFolder(
parent, name, props)
Expand Down
54 changes: 44 additions & 10 deletions cmis_field/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0e\n"
"Project-Id-Version: Odoo Server 10.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-16 10:28+0000\n"
"PO-Revision-Date: 2016-09-16 10:28+0000\n"
"POT-Creation-Date: 2017-11-09 17:01+0000\n"
"PO-Revision-Date: 2017-11-09 17:01+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -16,7 +16,21 @@ msgstr ""
"Plural-Forms: \n"

#. module: cmis_field
#: code:addons/cmis_field/fields/cmis_folder.py:92
#: code:addons/cmis_field/models/cmis_backend.py:84
#, python-format
msgid "%s is not a valid name.\n"
"The following chars are not allowed %s andthe name can not ends with a space or a '.'"
msgstr "%s n'est pas un nom valide.\n"
"Les charactères suivants ne sont pas autorisés '%s'. De plus, le nom ne peut pas se terminer par une espace ou un point"

#. module: cmis_field
#: code:addons/cmis_field/fields/cmis_folder.py:132
#, python-format
msgid "A value is already assigned to %s"
msgstr "Une valeur est déjà assignée à %s"

#. module: cmis_field
#: code:addons/cmis_field/fields/cmis_folder.py:82
#, python-format
msgid "Backend named %s not found. Please check your configuration."
msgstr "Aucun backend nommé %s trouvé. Veuillez vérifier votre configuration."
Expand All @@ -27,25 +41,45 @@ msgid "CMIS Backend"
msgstr "Backend CMIS"

#. module: cmis_field
#: code:addons/cmis_field/models/cmis_backend.py:44
#: model:ir.model.fields,help:cmis_field.field_cmis_backend_sanitize_replace_char
msgid "Character used as replacement of invalid characters found inthe value to use as cmis:name by the sanitize method"
msgstr "Caractères à utiliser pour remplacer les caractères invalides présents dans la valeur à utiliser comme nom dans le repository."

#. module: cmis_field
#: code:addons/cmis_field/models/cmis_backend.py:70
#, python-format
msgid "Expected 1 backend named %s, %s found"
msgstr "Un seul backend nommé %s attendu; %s trouvé"

#. module: cmis_field
#: model:ir.model,name:cmis_field.model_ir_model_fields
msgid "Fields"
msgstr "Champs"
#: model:ir.model.fields,help:cmis_field.field_cmis_backend_enable_sanitize_cmis_name
msgid "If checked, the name of the CMIS content created by the CMIS fields will be sanitized by replacing the characters not supported in a cmis:name with the one specified."
msgstr "Si coché la valeur à utiliser comme nom dans le repository est nettoyée en remplaçant les caractères invalides par celui spécifié comme valeur de remplacement."

#. module: cmis_field
#: code:addons/cmis_field/models/cmis_backend.py:46
#: code:addons/cmis_field/models/cmis_backend.py:72
#, python-format
msgid "No backend found"
msgstr "Aucun backend CMIS trouvé"

#. module: cmis_field
#: code:addons/cmis_field/fields/cmis_folder.py:96
#: code:addons/cmis_field/fields/cmis_folder.py:86
#, python-format
msgid "No backend found. Please check your configuration."
msgstr "Aucun backend CMIS trouvé. Veuillez vérifier votre configuration."

#. module: cmis_field
#: model:ir.model.fields,field_description:cmis_field.field_cmis_backend_sanitize_replace_char
msgid "Replacement char"
msgstr "Caractère de remplacement"

#. module: cmis_field
#: model:ir.model.fields,field_description:cmis_field.field_cmis_backend_enable_sanitize_cmis_name
msgid "Sanitize name on content creation?"
msgstr "Nettoyer le nom à la création?"

#. module: cmis_field
#: code:addons/cmis_field/models/cmis_backend.py:22
#, python-format
msgid "The character to use as replacement can not be one of'%s'"
msgstr "Le caractère de remplacement ne peut pas être une des valeurs suivantes '%s'"
51 changes: 49 additions & 2 deletions cmis_field/models/cmis_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ def _check_sanitize_replace_char(self):
help='Character used as replacement of invalid characters found in'
'the value to use as cmis:name by the sanitize method',
default='_')
folder_name_conflict_handler = fields.Selection(
selection=[
('error', _('Raise exception')),
('increment', _('Create as "name_(X)"'))
],
string='Strategy in case of duplicate',
required=True,
default='error',
)

@api.model
def _get_web_description(self, record):
Expand Down Expand Up @@ -67,8 +76,8 @@ def get_by_name(self, name, raise_if_not_found=True):
backend = self.search(domain)
if len(backend) != 1 and raise_if_not_found:
if name:
msg = _("Expected 1 backend named %s, %s found" %
(name, len(backend)))
msg = _("Expected 1 backend named %s, %s found") % \
(name, len(backend))
else:
msg = _('No backend found')
raise UserError(msg)
Expand Down Expand Up @@ -121,3 +130,41 @@ def get_folder_by_path_parts(self, path_parts, create_if_not_found=True,
path = "/".join(path_parts)
return self.get_folder_by_path(
path, create_if_not_found, cmis_parent_objectid)

@api.multi
def get_unique_folder_name(self, name, parent, conflict_handler=None):
"""Return a unique name for a folder into its parent.
Check if the name already exists into the parent.
If the name already exists:
if bakend.folder_name_conflict_handler == 'error'
ValidationError is raised
if backend.folder_name_conflict_handler == 'increment'
return a new name with suffix '_X'
:return: a unique name
"""
self.ensure_one()
conflict_handler = (conflict_handler or
self.folder_name_conflict_handler)
cmis_qry = ("SELECT cmis:objectId FROM cmis:folder WHERE "
"IN_FOLDER('%s') AND cmis:name='%s'" %
(parent.getObjectId(), name))
rs = parent.repository.query(cmis_qry)
num_found_items = rs.getNumItems()
if num_found_items > 0:
if conflict_handler == 'error':
raise ValidationError(
_('Folder "%s" already exists in CMIS') % (name))
if conflict_handler == 'increment':
testname = name + '_(%)'
cmis_qry = ("SELECT * FROM cmis:folder WHERE "
"IN_FOLDER('%s') AND cmis:name like '%s'" %
(parent.getObjectId(), testname))
rs = parent.repository.query(cmis_qry)
names = [r.name for r in rs]
max_num = 0
if names:
max_num = max(
[int(re.findall(r'_\((\d+)\)', n)[-1]) for n in names])
return name + '_(%d)' % (max_num + 1)
return name
Binary file added cmis_field/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ed4e065

Please sign in to comment.