diff --git a/src/documents/consumer.py b/src/documents/consumer.py index 19ca3ed7e..e4da51f1d 100755 --- a/src/documents/consumer.py +++ b/src/documents/consumer.py @@ -248,7 +248,7 @@ class Consumer(LoggingMixin): with open(self.path, "rb") as f: document = Document.objects.create( correspondent=file_info.correspondent, - title=file_info.title, + title=(self.override_title or file_info.title)[:127], content=text, mime_type=mime_type, checksum=hashlib.md5(f.read()).hexdigest(), @@ -265,12 +265,11 @@ class Consumer(LoggingMixin): self.apply_overrides(document) + document.save() + return document def apply_overrides(self, document): - if self.override_title: - document.title = self.override_title - if self.override_correspondent_id: document.correspondent = Correspondent.objects.get( pk=self.override_correspondent_id)