Skip to content

Update service free allowance when organisation type change #4371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 27, 2025

Conversation

spatel033
Copy link
Contributor

@spatel033 spatel033 commented Feb 4, 2025

Update the free allowance when updating organisation type. If the service free allowance has been updated manually then it should keep the manual allowance, this requirement should be handled as part of this story. More details on this card.
This PR needs to be merged after #4375

@spatel033 spatel033 force-pushed the update-service-free-allowance branch from ac2f126 to bbcad60 Compare February 4, 2025 14:09
@@ -158,6 +160,11 @@ def _update_organisation_services(organisation, attribute, only_where_none=True)
db.session.add(service)


def _update_organisation_services_free_allowance(organisation):
for service in organisation.services:
set_default_free_allowance_for_service(service, year_start=None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function only keeps the manual free allowances if they're 0, but not if they're any other value - it sounds like this isn't what we want to happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the changes with #4375. set_default_free_allowance_for_service has been refactored so allowance would be updated for any value.

@spatel033 spatel033 force-pushed the update-service-free-allowance branch from bbcad60 to d73a406 Compare February 10, 2025 13:41
@spatel033 spatel033 force-pushed the update-service-free-allowance branch from 48e8cca to c4d2267 Compare February 20, 2025 16:20
Update the free allowance when updating organisation type. If the service free allowance has been updated manually then it should keep the manual allowance.
fact_billing_dao is imported into multiple other dao, creating circular dependency for to get live services and free allowance for org. So moving dao_get_organisation_live_services_and_their_free_allowance into fact_billing_dao to break circular dependancy.
@spatel033 spatel033 force-pushed the update-service-free-allowance branch from c4d2267 to c7252b7 Compare February 20, 2025 16:22
@spatel033 spatel033 requested a review from klssmith February 20, 2025 16:36
@spatel033 spatel033 merged commit b9b0e11 into main Feb 27, 2025
5 checks passed
@spatel033 spatel033 deleted the update-service-free-allowance branch February 27, 2025 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants