Fix RecurMixin by making it an abstract model
This commit is contained in:
parent
b0c1e3e14f
commit
4dc0b86378
2 changed files with 7 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
from django.db.models import PositiveIntegerField, DateField, IntegerChoices
|
||||
from django.db.models import PositiveIntegerField, DateField, IntegerChoices, Model
|
||||
|
||||
class ActionChoices(IntegerChoices):
|
||||
WAIT = 0, "Do not invoice for now"
|
||||
|
@ -13,7 +13,10 @@ class CycleChoices(IntegerChoices):
|
|||
MONTHS = 2, "Months"
|
||||
YEARS = 3, "Years"
|
||||
|
||||
class RecurMixin:
|
||||
class RecurMixin(Model):
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
date = DateField()
|
||||
recur_action = PositiveIntegerField(choices=ActionChoices.choices)
|
||||
recur_cycle = PositiveIntegerField(choices=CycleChoices.choices)
|
||||
|
|
|
@ -2,6 +2,7 @@ from core.fields.numbers import CostField
|
|||
from core.models.local import Currency
|
||||
from core.models.profiles import ClientProfile
|
||||
from core.models.billable import BaseBillable
|
||||
from core.mixins.billable import RecurMixin
|
||||
|
||||
from django.db.models import Model, TextField, CharField, ManyToManyField, ForeignKey, CASCADE, PositiveIntegerField, OneToOneField, BooleanField, SET_NULL
|
||||
|
||||
|
@ -38,5 +39,5 @@ class ServicePlan(Model):
|
|||
for item in productplan.serviceplanitem_set:
|
||||
ServicePlanItem.objects.create(plan=plan, cycle=item.cycle, count=item.count, cost=item.cost)
|
||||
|
||||
class ServicePlanItem(BaseBillable):
|
||||
class ServicePlanItem(RecurMixin, BaseBillable):
|
||||
plan = ForeignKey(ServicePlan, on_delete=CASCADE)
|
||||
|
|
Loading…
Reference in a new issue