billing: Move exempt_from_from_license_number_check to Customer model.

This belongs more on the Customer model, since this is a similar
attribute to default_discount.
This commit is contained in:
Mateusz Mandera
2021-06-18 20:43:30 +02:00
committed by Tim Abbott
parent 4ca87d785b
commit bae86ad3da
3 changed files with 35 additions and 5 deletions

View File

@@ -72,7 +72,11 @@ def check_spare_licenses_available_for_adding_new_users(
realm: Realm, number_of_users_to_add: int
) -> None:
plan = get_current_plan_by_realm(realm)
if plan is None or plan.automanage_licenses or plan.exempt_from_from_license_number_check:
if (
plan is None
or plan.automanage_licenses
or plan.customer.exempt_from_from_license_number_check
):
return
if plan.licenses() < get_latest_seat_count(realm) + number_of_users_to_add: