Models for quotations

This commit is contained in:
Kumi 2020-06-12 07:20:19 +02:00
parent eade7c2729
commit 122a702fd1
2 changed files with 28 additions and 1 deletions

View file

@ -7,4 +7,5 @@ from core.models.products import ProductGroup, Product, ProductPlan, ProductPlan
from core.models.billable import BaseBillable from core.models.billable import BaseBillable
from core.models.services import Service, ServicePlan from core.models.services import Service, ServicePlan
from core.models.invoices import Invoice, InvoiceItem from core.models.invoices import Invoice, InvoiceItem
from core.models.api import APIKey from core.models.api import APIKey
from core.models.quotes import Quote, QuoteItem

26
core/models/quotes.py Normal file
View file

@ -0,0 +1,26 @@
from django.db.models import Model, ForeignKey, CASCADE, PositiveIntegerField, TextField, BooleanField, DateField, SET_NULL, PROTECT
from core.fields.base import LongCharField
from core.fields.numbers import CostField
from core.models.profiles import ClientProfile
from core.models.local import Currency
from core.models.brands import Brand
from core.models.services import Service
class Quote(Model):
client = ForeignKey(ClientProfile, on_delete=PROTECT)
brand = ForeignKey(Brand, on_delete=PROTECT)
number = LongCharField()
created = DateField()
expiry = DateField()
currency = ForeignKey(Currency, on_delete=PROTECT)
class QuoteItem(Model):
invoice = ForeignKey(Quote, on_delete=CASCADE)
sort = PositiveIntegerField()
name = LongCharField()
description = TextField(blank=True, null=True)
price = CostField()
discount = CostField()
taxable = BooleanField()
service = ForeignKey(Service, on_delete=SET_NULL, null=True)