diff --git a/InvenTree/InvenTree/models.py b/InvenTree/InvenTree/models.py index 103d571fd1..e192e34a0f 100644 --- a/InvenTree/InvenTree/models.py +++ b/InvenTree/InvenTree/models.py @@ -42,6 +42,8 @@ class InvenTreeAttachment(models.Model): Attributes: attachment: File comment: String descriptor for the attachment + user: User associated with file upload + upload_date: Date the file was uploaded """ def getSubdir(self): """ @@ -63,6 +65,8 @@ class InvenTreeAttachment(models.Model): help_text=_('User'), ) + upload_date = models.DateField(auto_now_add=True, null=True, blank=True) + @property def basename(self): return os.path.basename(self.attachment.name) diff --git a/InvenTree/order/migrations/0034_auto_20200512_1054.py b/InvenTree/order/migrations/0034_auto_20200512_1054.py new file mode 100644 index 0000000000..9124bb1cce --- /dev/null +++ b/InvenTree/order/migrations/0034_auto_20200512_1054.py @@ -0,0 +1,23 @@ +# Generated by Django 3.0.5 on 2020-05-12 10:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('order', '0033_auto_20200512_1033'), + ] + + operations = [ + migrations.AddField( + model_name='purchaseorderattachment', + name='upload_date', + field=models.DateField(auto_now_add=True, null=True), + ), + migrations.AddField( + model_name='salesorderattachment', + name='upload_date', + field=models.DateField(auto_now_add=True, null=True), + ), + ] diff --git a/InvenTree/part/migrations/0037_partattachment_upload_date.py b/InvenTree/part/migrations/0037_partattachment_upload_date.py new file mode 100644 index 0000000000..4169870178 --- /dev/null +++ b/InvenTree/part/migrations/0037_partattachment_upload_date.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.5 on 2020-05-12 10:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('part', '0036_partattachment_user'), + ] + + operations = [ + migrations.AddField( + model_name='partattachment', + name='upload_date', + field=models.DateField(auto_now_add=True, null=True), + ), + ] diff --git a/InvenTree/stock/migrations/0038_stockitemattachment_upload_date.py b/InvenTree/stock/migrations/0038_stockitemattachment_upload_date.py new file mode 100644 index 0000000000..0347b6f0ea --- /dev/null +++ b/InvenTree/stock/migrations/0038_stockitemattachment_upload_date.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.5 on 2020-05-12 10:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0037_stockitemattachment_user'), + ] + + operations = [ + migrations.AddField( + model_name='stockitemattachment', + name='upload_date', + field=models.DateField(auto_now_add=True, null=True), + ), + ] diff --git a/InvenTree/stock/templates/stock/item_attachments.html b/InvenTree/stock/templates/stock/item_attachments.html index d8210a5c65..4a6829bfcc 100644 --- a/InvenTree/stock/templates/stock/item_attachments.html +++ b/InvenTree/stock/templates/stock/item_attachments.html @@ -22,7 +22,7 @@ {% trans "File" %} {% trans "Comment" %} - {% trans "Uploaded By" %} + {% trans "Uploaded" %} @@ -32,7 +32,8 @@ {{ attachment.basename }} {{ attachment.comment }} - {% if attachment.user %}{{ attachment.user.username }}{% else %}-{% endif %} + {% if attachment.upload_date %}{{ attachment.upload_date }}{% endif %} + {% if attachment.user %}{{ attachment.user.username }}{% endif %}