Add product groups to billables and invoice items
This commit is contained in:
parent
49e43ad24d
commit
d9e96767d5
2 changed files with 6 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
from django.db.models import Model, ForeignKey, CASCADE, TextField, PositiveIntegerField, BooleanField, DateField
|
||||
from django.db.models import Model, ForeignKey, CASCADE, TextField, PositiveIntegerField, BooleanField, DateField, ManyToManyField
|
||||
from django.utils import timezone
|
||||
|
||||
from core.models.profiles import ClientProfile
|
||||
|
@ -7,6 +7,7 @@ from core.fields.base import LongCharField
|
|||
from core.fields.numbers import CostField
|
||||
from core.models.local import Currency
|
||||
from core.mixins.billable import RecurMixin
|
||||
from core.models.products import ProductGroup
|
||||
|
||||
from polymorphic.models import PolymorphicModel
|
||||
|
||||
|
@ -29,4 +30,4 @@ class BaseBillable(PolymorphicModel):
|
|||
raise NotImplementedError(f"{type(self)} does not implement property can_invoice!")
|
||||
|
||||
class Billable(RecurMixin, BaseBillable):
|
||||
pass
|
||||
product_groups = ManyToManyField(ProductGroup)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.db.models import Model, ForeignKey, CASCADE, PositiveIntegerField, TextField, BooleanField, DateField, SET_NULL, PROTECT
|
||||
from django.db.models import Model, ForeignKey, CASCADE, PositiveIntegerField, TextField, BooleanField, DateField, SET_NULL, PROTECT, ManyToManyField
|
||||
|
||||
from core.fields.base import LongCharField
|
||||
from core.fields.numbers import CostField
|
||||
|
@ -6,6 +6,7 @@ from core.models.profiles import ClientProfile
|
|||
from core.models.local import Currency
|
||||
from core.models.brands import Brand
|
||||
from core.models.billable import BaseBillable
|
||||
from core.models.products import ProductGroup
|
||||
|
||||
class Invoice(Model):
|
||||
client = ForeignKey(ClientProfile, on_delete=PROTECT)
|
||||
|
@ -21,6 +22,7 @@ class InvoiceItem(Model):
|
|||
sort = PositiveIntegerField()
|
||||
name = LongCharField()
|
||||
description = TextField(blank=True, null=True)
|
||||
product_groups = ManyToManyField(ProductGroup)
|
||||
price = CostField()
|
||||
discount = CostField()
|
||||
taxable = BooleanField()
|
||||
|
|
Loading…
Reference in a new issue