Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

inbox tags, archive tags, archive serial number for documents

Jonas Winklerc3a144f2ca9b
diff --git a/src/documents/management/commands/document_correspondents.py b/src/documents/management/commands/document_correspondents.py
old mode 100644
new mode 100755
index 0709c49d2..d3b324bb1
--- a/src/documents/management/commands/document_correspondents.py
+++ b/src/documents/management/commands/document_correspondents.py
@@ -41,7 +41,7 @@ class Command(Renderable, BaseCommand):
self.verbosity = options["verbosity"]
- for document in Document.objects.filter(correspondent__isnull=True):
+ for document in Document.objects.filter(correspondent__isnull=True).exclude(tags__is_archived_tag=True):
potential_correspondents = list(
Correspondent.match_all(document.content))
diff --git a/src/documents/management/commands/document_retagger.py b/src/documents/management/commands/document_retagger.py
old mode 100644
new mode 100755
index 8f56e1eea..d3fd83962
--- a/src/documents/management/commands/document_retagger.py
+++ b/src/documents/management/commands/document_retagger.py
@@ -22,7 +22,7 @@ class Command(Renderable, BaseCommand):
self.verbosity = options["verbosity"]
- for document in Document.objects.all():
+ for document in Document.objects.all().exclude(tags__is_archived_tag=True):
tags = Tag.objects.exclude(
pk__in=document.tags.values_list("pk", flat=True))
diff --git a/src/documents/migrations/0022_workflow_improvements.py b/src/documents/migrations/0022_workflow_improvements.py
new file mode 100755
index 000000000..534cb78e7
--- /dev/null
+++ b/src/documents/migrations/0022_workflow_improvements.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.10 on 2018-02-04 13:07
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('documents', '0021_document_storage_type'),
+ ]
+
+ operations = [
+
+ migrations.AddField(
+ model_name='document',
+ name='archive_serial_number',
+ field=models.IntegerField(unique=True, blank=True, null=True, db_index=True),
+ ),
+
+ migrations.AddField(
+ model_name='tag',
+ name='is_inbox_tag',
+ field=models.BooleanField(default=False),
+ ),
+
+ migrations.AddField(
+ model_name='tag',
+ name='is_archived_tag',
+ field=models.BooleanField(default=False),
+ ),
+
+ ]
diff --git a/src/documents/models.py b/src/documents/models.py
index 780cddb0a..2da28da57 100755
--- a/src/documents/models.py
+++ b/src/documents/models.py
@@ -180,6 +180,14 @@ class Tag(MatchingModel):
colour = models.PositiveIntegerField(choices=COLOURS, default=1)
+ is_inbox_tag = models.BooleanField(
+ default=False,
+ help_text="Marks this tag as an inbox tag: All newly consumed documents will be tagged with inbox tags.")
+
+ is_archived_tag = models.BooleanField(
+ default=False,
+ help_text="Marks this tag as an archive tag: All documents tagged with archive tags will never be modified automatically (i.e., modifying tags by matching rules)")
+
class Document(models.Model):
@@ -247,6 +255,13 @@ class Document(models.Model):
added = models.DateTimeField(
default=timezone.now, editable=False, db_index=True)
+ archive_serial_number = models.IntegerField(
+ blank=True,
+ null=True,
+ unique=True,
+ db_index=True,
+ help_text="The position of this document in your physical document archive.")
+
class Meta:
ordering = ("correspondent", "title")
diff --git a/src/documents/signals/handlers.py b/src/documents/signals/handlers.py
old mode 100644
new mode 100755
index cdeaaba40..b3579b567
--- a/src/documents/signals/handlers.py
+++ b/src/documents/signals/handlers.py
@@ -47,7 +47,7 @@ def set_correspondent(sender, document=None, logging_group=None, **kwargs):
def set_tags(sender, document=None, logging_group=None, **kwargs):
current_tags = set(document.tags.all())
- relevant_tags = set(Tag.match_all(document.content)) - current_tags
+ relevant_tags = (set(Tag.match_all(document.content)) | set(Tag.objects.filter(is_inbox_tag=True))) - current_tags
if not relevant_tags:
return