diff --git a/hypha/apply/projects/migrations/0014_add_payment_related_models.py b/hypha/apply/projects/migrations/0014_add_payment_related_models.py index b8bfe32afce50b252a1f5c159005b67dd13bf7d5..6d250951a2c5d0a80c9a78598c57d283099959b3 100644 --- a/hypha/apply/projects/migrations/0014_add_payment_related_models.py +++ b/hypha/apply/projects/migrations/0014_add_payment_related_models.py @@ -28,7 +28,7 @@ class Migration(migrations.Migration): name='PaymentReceipt', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('file', models.FileField(storage=django.core.files.storage.FileSystemStorage(), upload_to=hypha.apply.projects.models.payment.receipt_path)), + ('file', models.FileField(storage=django.core.files.storage.FileSystemStorage())), ], ), migrations.CreateModel( diff --git a/hypha/apply/projects/models/payment.py b/hypha/apply/projects/models/payment.py index 21bd6d7aaa176f0cb3e636d14322b3870de66d5f..9315e0e324c9e61394e0a695c967e4308f949cc9 100644 --- a/hypha/apply/projects/models/payment.py +++ b/hypha/apply/projects/models/payment.py @@ -59,10 +59,6 @@ def invoice_status_user_choices(user): return [] -def receipt_path(instance, filename): - return f'projects/{instance.project_id}/payment_invoices/{filename}' - - def invoice_path(instance, filename): return f'projects/{instance.project_id}/payment_invoices/{filename}' diff --git a/hypha/apply/projects/tests/test_models.py b/hypha/apply/projects/tests/test_models.py index 99a6b73c7046997bf50d44314f2a99e15f035744..4ee923a46858a851ad445591e24d494a107e88a0 100644 --- a/hypha/apply/projects/tests/test_models.py +++ b/hypha/apply/projects/tests/test_models.py @@ -32,7 +32,9 @@ from ..models.payment import ( from ..models.project import Project from ..models.report import Report, ReportConfig from .factories import ( + DeliverableFactory, DocumentCategoryFactory, + InvoiceDeliverableFactory, InvoiceFactory, PacketFileFactory, ProjectFactory, @@ -190,6 +192,15 @@ class TestInvoiceModel(TestCase): ) self.assertEqual(invoice.value, Decimal('2')) + def test_deliverables_total_amount(self): + deliverable = DeliverableFactory(unit_price=100) + invoice_deliverable = InvoiceDeliverableFactory(deliverable=deliverable, quantity=2) + self.assertEqual(invoice_deliverable.deliverable.unit_price, 100.00) + + invoice = InvoiceFactory(status=APPROVED_BY_STAFF) + invoice.deliverables.add(invoice_deliverable) + self.assertEqual(invoice.deliverables_total_amount['total'], 200.00) + def test_staff_can_change_status(self): statuses = [SUBMITTED, RESUBMITTED, CHANGES_REQUESTED_BY_STAFF, CHANGES_REQUESTED_BY_FINANCE_1] user = StaffFactory()