billing: Allow to exclude realms from license limit check.

This commit is contained in:
Vishnu KS
2021-06-08 16:13:44 +05:30
committed by Tim Abbott
parent 1938076f67
commit 42119c136b
3 changed files with 24 additions and 4 deletions

View File

@@ -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()