From be208f73f77d18ed33d49312dcd36225e6c90f4d Mon Sep 17 00:00:00 2001 From: Mateusz Mandera Date: Mon, 10 Apr 2023 20:23:12 +0200 Subject: [PATCH] billing: Fix exempt_from_from_license_number_check column name. exempt_from_from_license_number_check was clearly not intended. --- corporate/lib/registration.py | 6 +----- ...customer_exempt_from_license_number_check.py | 17 +++++++++++++++++ corporate/models.py | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 corporate/migrations/0017_rename_exempt_from_from_license_number_check_customer_exempt_from_license_number_check.py diff --git a/corporate/lib/registration.py b/corporate/lib/registration.py index 0390a820fa..65d50b5d5e 100644 --- a/corporate/lib/registration.py +++ b/corporate/lib/registration.py @@ -72,11 +72,7 @@ def check_spare_licenses_available_for_adding_new_users( realm: Realm, extra_non_guests_count: int = 0, extra_guests_count: int = 0 ) -> None: plan = get_current_plan_by_realm(realm) - if ( - plan is None - or plan.automanage_licenses - or plan.customer.exempt_from_from_license_number_check - ): + if plan is None or plan.automanage_licenses or plan.customer.exempt_from_license_number_check: return if plan.licenses() < get_seat_count( diff --git a/corporate/migrations/0017_rename_exempt_from_from_license_number_check_customer_exempt_from_license_number_check.py b/corporate/migrations/0017_rename_exempt_from_from_license_number_check_customer_exempt_from_license_number_check.py new file mode 100644 index 0000000000..ed5b804d54 --- /dev/null +++ b/corporate/migrations/0017_rename_exempt_from_from_license_number_check_customer_exempt_from_license_number_check.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2 on 2023-04-10 18:22 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("corporate", "0016_customer_add_remote_server_field"), + ] + + operations = [ + migrations.RenameField( + model_name="customer", + old_name="exempt_from_from_license_number_check", + new_name="exempt_from_license_number_check", + ), + ] diff --git a/corporate/models.py b/corporate/models.py index 99330f71f7..b40807a465 100644 --- a/corporate/models.py +++ b/corporate/models.py @@ -26,7 +26,7 @@ class Customer(models.Model): # only for their paid employees. We don't prevent these # organizations from adding more users than the number of licenses # they purchased. - exempt_from_from_license_number_check = models.BooleanField(default=False) + exempt_from_license_number_check = models.BooleanField(default=False) def __str__(self) -> str: return f"{self.realm!r} {self.stripe_customer_id}"