karrio-server-pricing 2025.5rc14__py3-none-any.whl → 2025.5rc15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- karrio/server/pricing/migrations/0065_fix_surcharge_type_enum.py +36 -0
- karrio/server/pricing/migrations/0066_alter_surcharge_carriers_alter_surcharge_services_and_more.py +4712 -0
- karrio/server/pricing/models.py +1 -0
- karrio/server/pricing/serializers.py +3 -3
- karrio/server/pricing/tests.py +32 -32
- {karrio_server_pricing-2025.5rc14.dist-info → karrio_server_pricing-2025.5rc15.dist-info}/METADATA +1 -1
- {karrio_server_pricing-2025.5rc14.dist-info → karrio_server_pricing-2025.5rc15.dist-info}/RECORD +9 -7
- {karrio_server_pricing-2025.5rc14.dist-info → karrio_server_pricing-2025.5rc15.dist-info}/WHEEL +0 -0
- {karrio_server_pricing-2025.5rc14.dist-info → karrio_server_pricing-2025.5rc15.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Generated by Django
|
|
2
|
+
|
|
3
|
+
from django.db import migrations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def fix_surcharge_types(apps, schema_editor):
|
|
7
|
+
"""Convert surcharge_type from symbols to enum names"""
|
|
8
|
+
Surcharge = apps.get_model('pricing', 'Surcharge')
|
|
9
|
+
|
|
10
|
+
# Update $ to AMOUNT
|
|
11
|
+
updated_amount = Surcharge.objects.filter(surcharge_type='$').update(surcharge_type='AMOUNT')
|
|
12
|
+
|
|
13
|
+
# Update % to PERCENTAGE
|
|
14
|
+
updated_percentage = Surcharge.objects.filter(surcharge_type='%').update(surcharge_type='PERCENTAGE')
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def reverse_surcharge_types(apps, schema_editor):
|
|
18
|
+
"""Reverse the changes - convert back to symbols"""
|
|
19
|
+
Surcharge = apps.get_model('pricing', 'Surcharge')
|
|
20
|
+
|
|
21
|
+
# Reverse AMOUNT to $
|
|
22
|
+
Surcharge.objects.filter(surcharge_type='AMOUNT').update(surcharge_type='$')
|
|
23
|
+
|
|
24
|
+
# Reverse PERCENTAGE to %
|
|
25
|
+
Surcharge.objects.filter(surcharge_type='PERCENTAGE').update(surcharge_type='%')
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Migration(migrations.Migration):
|
|
29
|
+
|
|
30
|
+
dependencies = [
|
|
31
|
+
('pricing', '0064_alter_surcharge_carriers_alter_surcharge_services'),
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
operations = [
|
|
35
|
+
migrations.RunPython(fix_surcharge_types, reverse_surcharge_types),
|
|
36
|
+
]
|