diff --git a/core/models/products.py b/core/models/products.py index 71ca9ec..95bd8d5 100644 --- a/core/models/products.py +++ b/core/models/products.py @@ -34,14 +34,15 @@ class Product(Model): return None class ProductPlan(Model): - product = ForeignKey(Product, on_delete=CASCADE) - currency = ForeignKey(Currency, on_delete=CASCADE) - -class ProductPlanItem(Model): from core.models.billable import CycleChoices - plan = ForeignKey(ProductPlan, on_delete=CASCADE) + product = ForeignKey(Product, on_delete=CASCADE) + currency = ForeignKey(Currency, on_delete=CASCADE) cycle = PositiveIntegerField(choices=CycleChoices.choices) count = PositiveIntegerField() cost = CostField() - taxable = BooleanField() \ No newline at end of file + setup = CostField() + taxable = BooleanField() + + + \ No newline at end of file diff --git a/core/models/services.py b/core/models/services.py index 4b43ca6..0d8876a 100644 --- a/core/models/services.py +++ b/core/models/services.py @@ -24,6 +24,7 @@ class Service(Model): cycle = PositiveIntegerField(choices=CycleChoices.choices) count = PositiveIntegerField() cost = CostField() + setup = CostField() taxable=BooleanField() @property @@ -38,18 +39,18 @@ class Service(Model): return None @classmethod - def from_productplanitem(cls, productplanitem, client): - plan = cls.objects.create(client=client, - name=productplanitem.plan.product.name, - description=productplanitem.plan.product.description, - service_type=productplanitem.plan.product.product_type, - product=productplanitem.plan.product, - product_groups=productplanitem.plan.product.product_groups, - currency=productplanitem.plan.currency, - cycle=productplanitem.cycle, - count=productplanitem.count, - cost=productplanitem.cost, - taxable=productplanitem.taxable) + def from_productplan(cls, productplan, client): + cls.objects.create(client=client, + name=productplan.product.name, + description=productplan.product.description, + service_type=productplan.product.product_type, + product=productplan.product, + product_groups=productplan.product.product_groups, + currency=productplan.currency, + cycle=productplan.cycle, + count=productplan.count, + cost=productplan.cost, + taxable=productplan.taxable) @property def invoicable(self):