Merge branch 'feature/document_importer' into nightly

Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-06-21 17:39:19 -04:00
3 changed files with 10 additions and 7 deletions

View File

@@ -12,6 +12,8 @@ Importer branch
==================
* Add support for disabling the random primary key
test mixin.
* Add a reusable task to upload documents.
* Add MVP of the importer app.
* Fix mailing profile log columns mappings.
GitLab issue #626. Thanks to Jesaja Everling (@jeverling)
for the report.
@@ -21,7 +23,6 @@ Importer branch
* Increase the Django STMP username.
GitLab issue #625. Thanks to Jesaja Everling (@jeverling)
for the report and the research.
>>>>>>> versions/minor
3.2.2 (2019-06-19)
==================

View File

@@ -19,7 +19,6 @@ Changes
GitLab issue #625. Thanks to Jesaja Everling (@jeverling)
for the report and the research.
Removals
--------
@@ -107,12 +106,8 @@ Backward incompatible changes
Bugs fixed or issues closed
---------------------------
<<<<<<< HEAD
- :gitlab-issue:`615`
=======
- :gitlab-issue:`619` poplib.POP3_SSL and poplib.POP3 initialized with wrong kwarg
- :gitlab-issue:`625` mayan.apps.mailer.mailers.DjangoSMTP uses "user", but django.core.mail.backends.smtp.EmailBackend expects "username"
- :gitlab-issue:`626` Mailing profile error log is empty, despite errors
>>>>>>> versions/minor
.. _PyPI: https://pypi.python.org/pypi/mayan-edms/

View File

@@ -65,13 +65,20 @@ def task_upload_new_document(self, document_type_id, shared_uploaded_file_id, ex
if extra_data:
for pair in extra_data.get('metadata_pairs', []):
name = slugify(pair['name']).replace('-', '_')
logger.debug(
'Metadata pair (label, name, value): %s, %s, %s',
pair['name'], name, pair['value']
)
metadata_type, created = MetadataType.objects.get_or_create(
label=pair['name'], defaults={'name': name}
)
if created:
if not new_document.document_type.metadata.filter(metadata_type=metadata_type).exists():
logger.debug('Metadata type created')
new_document.document_type.metadata.create(
metadata_type=metadata_type, required=False
)
new_document.metadata.create(
metadata_type=metadata_type, value=pair['value']
)