karrio-server-pricing 2025.5rc14__py3-none-any.whl → 2025.5rc16__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.
@@ -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
+ ]