(self, instance, validated_data)
| 1433 | return data |
| 1434 | |
| 1435 | def update(self, instance, validated_data): |
| 1436 | if instance.payment_status == Invoice.PaymentStatus.PAID: |
| 1437 | raise serializers.ValidationError( |
| 1438 | "Cannot update a paid invoice. Please create a credit note instead." |
| 1439 | ) |
| 1440 | instance.payment_status = validated_data.get( |
| 1441 | "payment_status", instance.payment_status |
| 1442 | ) |
| 1443 | instance.save() |
| 1444 | if instance.payment_status == Invoice.PaymentStatus.PAID: |
| 1445 | kafka_producer.produce_invoice_pay_in_full( |
| 1446 | invoice=instance, payment_date=now_utc(), source="lotus_out_of_band" |
| 1447 | ) |
| 1448 | return instance |
| 1449 | |
| 1450 | |
| 1451 | class InitialExternalPlanLinkSerializer( |
nothing calls this directly
no test coverage detected