Avoid key errors by setting the year_start with 2020 or 2021

Remove db.create_service_with_organisation method
Update comment in command
This commit is contained in:
Rebecca Law
2021-03-30 09:08:04 +01:00
parent 7da5abc17b
commit da8a7a8db1
4 changed files with 9 additions and 11 deletions

View File

@@ -891,7 +891,7 @@ def populate_annual_billing_with_the_previous_years_allowance(year):
def populate_annual_billing_with_defaults(year, missing_services_only):
"""
Add or update annual billing with free allowance defaults for all active services.
DEFAULT_FREE_SMS_FRAGMENT_LIMITS is the new free allowances for the financial year starting 2021.
The default free allowance limits are in: app/dao/annual_billing_dao.py:57.
If missing_services_only is true then only add rows for services that do not have annual billing for that year yet.
This is useful to prevent overriding any services that have a free allowance that is not the default.

View File

@@ -90,6 +90,10 @@ def set_default_free_allowance_for_service(service, year_start=None):
}
if not year_start:
year_start = get_current_financial_year_start_year()
if year_start < 2020:
year_start = 2020
if year_start > 2021:
year_start = 2021
if service.organisation_type:
free_allowance = default_free_sms_fragment_limits[service.organisation_type][year_start]
else: