This commit is contained in:
2025-10-08 10:13:07 +02:00
parent 70e055d20b
commit b74cf45c5c
10 changed files with 813 additions and 91 deletions

View File

@@ -3,6 +3,29 @@ from django.utils import timezone
from django.core.validators import MinValueValidator, MaxValueValidator
class Betriebskosten(models.Model):
KOSTENTYP_CHOICES = [
('sach', 'Sachkostöen'),
('ln2', 'LN2'),
('helium', 'Helium'),
('inv', 'Inventar'),
]
buchungsdatum = models.DateField('Buchungsdatum')
rechnungsnummer = models.CharField('Rechnungsnummer', max_length=50)
kostentyp = models.CharField('Kostentyp', max_length=10, choices=KOSTENTYP_CHOICES)
gas_volume = models.DecimalField('Gasvolumen (Liter)', max_digits=10, decimal_places=2, null=True, blank=True)
betrag = models.DecimalField('Betrag (€)', max_digits=10, decimal_places=2)
beschreibung = models.TextField('Beschreibung', blank=True)
@property
def price_per_liter(self):
if self.kostentyp == 'helium' and self.gas_volume:
return self.betrag / self.gas_volume
return None
def __str__(self):
return f"{self.buchungsdatum} - {self.get_kostentyp_display()} - {self.betrag}" # Fixed the missing quote
class Client(models.Model):
name = models.CharField(max_length=100)