Skip to content
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

State change on connection and subsidiary update #428

Merged
merged 11 commits into from
Oct 17, 2023
10 changes: 9 additions & 1 deletion apps/mappings/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@
from apps.workspaces.models import Configuration
from apps.workspaces.tasks import delete_cards_mapping_settings

from .models import GeneralMapping
from .models import GeneralMapping, SubsidiaryMapping
from .tasks import schedule_auto_map_ccc_employees


@receiver(post_save, sender=SubsidiaryMapping)
def run_post_subsidiary_mappings(sender, instance: SubsidiaryMapping, **kwargs):

workspace = instance.workspace
workspace.onboarding_state = 'MAP_EMPLOYEES'
workspace.save()

@receiver(post_save, sender=MappingSetting)
def run_post_mapping_settings_triggers(sender, instance: MappingSetting, **kwargs):
"""
Expand Down
1 change: 1 addition & 0 deletions apps/workspaces/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def post(self, request, **kwargs):
workspace=workspace
)
workspace.ns_account_id = ns_account_id
workspace.onboarding_state = 'SUBSIDIARY'
workspace.save()

else:
Expand Down
Loading