expephalon/core/models/invoices.py
Klaus-Uwe Mitterer 2e8bbdd8a7 A lot of new views
Color picker fields
Renamed pixel.png in order not to upset uBlock...
2020-06-02 17:58:20 +02:00

24 lines
No EOL
972 B
Python

from django.db.models import Model, ForeignKey, CASCADE, PositiveIntegerField, TextField, DecimalField, BooleanField, DateField, SET_NULL, PROTECT
from core.fields.base import LongCharField
from core.models.services import Service
from core.models.profiles import ClientProfile
from core.models.local import Currency
class Invoice(Model):
client = ForeignKey(ClientProfile, on_delete=CASCADE)
number = LongCharField()
created = DateField()
due = DateField()
payment_method = LongCharField()
currency = ForeignKey(Currency, on_delete=PROTECT)
class InvoiceItem(Model):
invoice = ForeignKey(Invoice, on_delete=CASCADE)
sort = PositiveIntegerField()
name = LongCharField()
description = TextField(blank=True, null=True)
price = DecimalField(max_digits=32, decimal_places=2)
discount = DecimalField(max_digits=32, decimal_places=2)
taxable = BooleanField()
service = ForeignKey(Service, on_delete=SET_NULL, null=True)