Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
billing: Allow to exclude realms from license limit check.
Vishnu KS42119c136b1a
diff --git a/corporate/lib/registration.py b/corporate/lib/registration.pyindex 60f05946a31..5cc6fcbcdb3 100644--- a/corporate/lib/registration.py+++ b/corporate/lib/registration.py@@ -71,12 +71,10 @@ def send_user_unable_to_signup_message_to_signup_notification_stream(def check_spare_licenses_available_for_adding_new_users(realm: Realm, number_of_users_to_add: int) -> None:- if realm.string_id in settings.LICENSE_CHECK_EXEMPTED_REALMS_ON_MANUAL_PLAN:- return # nocoverage-plan = get_current_plan_by_realm(realm)- if plan is None or plan.automanage_licenses:+ if plan is None or plan.automanage_licenses or plan.exempt_from_from_license_number_check:return+if plan.licenses() < get_latest_seat_count(realm) + number_of_users_to_add:raise LicenseLimitError()diff --git a/corporate/migrations/0010_customerplan_exempt_from_from_license_number_check.py b/corporate/migrations/0010_customerplan_exempt_from_from_license_number_check.pynew file mode 100644index 00000000000..0769db7191d--- /dev/null+++ b/corporate/migrations/0010_customerplan_exempt_from_from_license_number_check.py@@ -0,0 +1,18 @@+# Generated by Django 3.2.2 on 2021-06-08 08:57++from django.db import migrations, models+++class Migration(migrations.Migration):++ dependencies = [+ ("corporate", "0009_customer_sponsorship_pending"),+ ]++ operations = [+ migrations.AddField(+ model_name="customerplan",+ name="exempt_from_from_license_number_check",+ field=models.BooleanField(default=False),+ ),+ ]diff --git a/corporate/models.py b/corporate/models.pyindex c4039b4cc5e..863488db954 100644--- a/corporate/models.py+++ b/corporate/models.py@@ -45,6 +45,10 @@ class CustomerPlan(models.Model):automanage_licenses: bool = models.BooleanField(default=False)charge_automatically: bool = models.BooleanField(default=False)+ # Some non-profit organizations on manual license management pay 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: bool = models.BooleanField(default=False)+# Both of these are in cents. Exactly one of price_per_license or# fixed_price should be set. fixed_price is only for manual deals, and# can't be set via the self-serve billing system.