-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #277 from rafaelurben/dev
v1.8.3
- Loading branch information
Showing
20 changed files
with
445 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.8.2 | ||
1.8.3 |
99 changes: 99 additions & 0 deletions
99
kmuhelper/migrations/0115_migrate_payment_receiver_address_format.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Generated by Django 5.0.4 on 2024-04-17 23:03 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def migrate_address_fields(apps, schema_editor): | ||
PaymentReceiver = apps.get_model("kmuhelper", "PaymentReceiver") | ||
for receiver in PaymentReceiver.objects.all(): | ||
receiver.invoice_street = receiver.invoice_address_1[:70] | ||
|
||
_index = receiver.invoice_address_2.index(" ") | ||
receiver.invoice_postcode = receiver.invoice_address_2[:_index] | ||
receiver.invoice_city = receiver.invoice_address_2[_index + 1 : _index + 36] | ||
|
||
receiver.save() | ||
|
||
|
||
def migrate_address_fields_reverse(apps, schema_editor): | ||
PaymentReceiver = apps.get_model("kmuhelper", "PaymentReceiver") | ||
for receiver in PaymentReceiver.objects.all(): | ||
receiver.invoice_address_1 = ( | ||
f"{receiver.invoice_street} {receiver.invoice_street_nr}".strip() | ||
) | ||
receiver.invoice_address_2 = ( | ||
f"{receiver.invoice_postcode} {receiver.invoice_city}".strip() | ||
) | ||
receiver.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("kmuhelper", "0114_adminlogentry_alter_order_payment_conditions"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="paymentreceiver", | ||
name="invoice_city", | ||
field=models.CharField(default="", max_length=35, verbose_name="Ort"), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name="paymentreceiver", | ||
name="invoice_postcode", | ||
field=models.CharField( | ||
default="", max_length=16, verbose_name="Postleitzahl" | ||
), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name="paymentreceiver", | ||
name="invoice_street", | ||
field=models.CharField( | ||
default="", | ||
help_text="Strasse oder Postfach", | ||
max_length=70, | ||
verbose_name="Strasse", | ||
), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name="paymentreceiver", | ||
name="invoice_street_nr", | ||
field=models.CharField( | ||
blank=True, default="", max_length=16, verbose_name="Hausnummer" | ||
), | ||
preserve_default=False, | ||
), | ||
migrations.RunPython( | ||
code=migrate_address_fields, | ||
reverse_code=migrate_address_fields_reverse, | ||
elidable=True, | ||
), | ||
migrations.RemoveField( | ||
model_name="paymentreceiver", | ||
name="invoice_address_1", | ||
), | ||
migrations.RemoveField( | ||
model_name="paymentreceiver", | ||
name="invoice_address_2", | ||
), | ||
migrations.AlterField( | ||
model_name="paymentreceiver", | ||
name="invoice_country", | ||
field=models.CharField( | ||
choices=[("CH", "Schweiz"), ("LI", "Liechtenstein")], | ||
default="CH", | ||
max_length=2, | ||
verbose_name="Land", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="paymentreceiver", | ||
name="invoice_name", | ||
field=models.CharField( | ||
help_text="Name / Firma", max_length=70, verbose_name="Kontoinhaber" | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.