This commit is contained in:
j3d1 2024-06-18 17:42:16 +02:00
parent 373bc7ad40
commit a2633bff7a
4 changed files with 51 additions and 13 deletions

View file

@ -1,3 +1,4 @@
from django.utils import timezone
from django.db import models
from django_softdelete.models import SoftDeleteModel
@ -148,3 +149,10 @@ class ShippingVoucher(models.Model):
def __str__(self):
return self.voucher + ' (' + self.type + ')'
def save(self, *args, **kwargs):
if self.used_at is None and self.issue_thread is not None:
self.used_at = timezone.now()
super().save(*args, **kwargs)