From 122a702fd1f7ffa20b3d3b9cddc47dff6d2af7c2 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Fri, 12 Jun 2020 07:20:19 +0200 Subject: [PATCH] Models for quotations --- core/models/__init__.py | 3 ++- core/models/quotes.py | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 core/models/quotes.py diff --git a/core/models/__init__.py b/core/models/__init__.py index a6e9a43..65d6846 100644 --- a/core/models/__init__.py +++ b/core/models/__init__.py @@ -7,4 +7,5 @@ from core.models.products import ProductGroup, Product, ProductPlan, ProductPlan from core.models.billable import BaseBillable from core.models.services import Service, ServicePlan from core.models.invoices import Invoice, InvoiceItem -from core.models.api import APIKey \ No newline at end of file +from core.models.api import APIKey +from core.models.quotes import Quote, QuoteItem \ No newline at end of file diff --git a/core/models/quotes.py b/core/models/quotes.py new file mode 100644 index 0000000..16a8720 --- /dev/null +++ b/core/models/quotes.py @@ -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) \ No newline at end of file