add addons to services

This commit is contained in:
Tobias Brunner 2025-06-19 16:19:59 +02:00
parent b96b186875
commit 22e527bcd9
No known key found for this signature in database
8 changed files with 1039 additions and 4 deletions

View file

@ -0,0 +1,195 @@
# Generated by Django 5.2 on 2025-06-19 13:53
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("services", "0034_article"),
]
operations = [
migrations.AlterField(
model_name="article",
name="image",
field=models.ImageField(
help_text="Title picture for the article", upload_to="article_images/"
),
),
migrations.CreateModel(
name="VSHNAppCatAddon",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"name",
models.CharField(help_text="Name of the addon", max_length=100),
),
(
"description",
models.TextField(
blank=True, help_text="Technical description of the addon"
),
),
(
"commercial_description",
models.TextField(
blank=True,
help_text="Commercial description displayed in the frontend",
),
),
(
"addon_type",
models.CharField(
choices=[("BF", "Base Fee"), ("UR", "Unit Rate")],
help_text="Type of addon pricing (fixed fee or per-unit)",
max_length=2,
),
),
(
"mandatory",
models.BooleanField(
default=False, help_text="Is this addon mandatory?"
),
),
(
"active",
models.BooleanField(
default=True,
help_text="Is this addon active and available for selection?",
),
),
(
"order",
models.IntegerField(
default=0, help_text="Display order in the frontend"
),
),
("valid_from", models.DateTimeField(blank=True, null=True)),
("valid_to", models.DateTimeField(blank=True, null=True)),
(
"vshn_appcat_price_config",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="addons",
to="services.vshnappcatprice",
),
),
],
options={
"verbose_name": "Service Addon",
"ordering": ["order", "name"],
},
),
migrations.CreateModel(
name="VSHNAppCatAddonBaseFee",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"currency",
models.CharField(
choices=[
("CHF", "Swiss Franc"),
("EUR", "Euro"),
("USD", "US Dollar"),
],
max_length=3,
),
),
(
"amount",
models.DecimalField(
decimal_places=2,
help_text="Base fee in the specified currency, excl. VAT",
max_digits=10,
),
),
(
"addon",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="base_fees",
to="services.vshnappcataddon",
),
),
],
options={
"verbose_name": "Addon Base Fee",
"ordering": ["currency"],
"unique_together": {("addon", "currency")},
},
),
migrations.CreateModel(
name="VSHNAppCatAddonUnitRate",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"currency",
models.CharField(
choices=[
("CHF", "Swiss Franc"),
("EUR", "Euro"),
("USD", "US Dollar"),
],
max_length=3,
),
),
(
"service_level",
models.CharField(
choices=[
("BE", "Best Effort"),
("GA", "Guaranteed Availability"),
],
max_length=2,
),
),
(
"amount",
models.DecimalField(
decimal_places=4,
help_text="Price per unit in the specified currency and service level, excl. VAT",
max_digits=10,
),
),
(
"addon",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="unit_rates",
to="services.vshnappcataddon",
),
),
],
options={
"verbose_name": "Addon Unit Rate",
"ordering": ["currency", "service_level"],
"unique_together": {("addon", "currency", "service_level")},
},
),
]