File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -360,7 +360,8 @@ def clean(self):
360360 if (
361361 not self ._state .adding
362362 and self .payment_type != PaymentTypeChoices .COMPLIMENTARY
363- and self .payment_status != PaymentStatusChoices .INITIALIZED
363+ and self .initial_value ("payment_status" )
364+ != PaymentStatusChoices .INITIALIZED
364365 ):
365366 # Assert total amount unchanged
366367 if (
Original file line number Diff line number Diff line change @@ -451,6 +451,26 @@ def test_total_amount_can_change_for_complimentary_invoices():
451451 invoice .clean ()
452452
453453
454+ @pytest .mark .parametrize (
455+ "payment_type" , (PaymentTypeChoices .PREPAID , PaymentTypeChoices .POSTPAID )
456+ )
457+ @pytest .mark .django_db
458+ def test_updating_total_amount_and_status_simultaneously_is_possible (
459+ payment_type ,
460+ ):
461+ invoice = InvoiceFactory (
462+ payment_type = payment_type ,
463+ payment_status = PaymentStatusChoices .INITIALIZED ,
464+ support_costs_euros = 0 ,
465+ compute_costs_euros = 1 ,
466+ storage_costs_euros = 2 ,
467+ )
468+ invoice .support_costs_euros = 2
469+ invoice .payment_status = PaymentStatusChoices .REQUESTED
470+ with nullcontext ():
471+ invoice .clean ()
472+
473+
454474@pytest .mark .django_db
455475def test_invoices_cannot_be_deleted ():
456476 invoice = InvoiceFactory ()
You can’t perform that action at this time.
0 commit comments