From 0db881a999c2483100686ae354ab66eaebb239e7 Mon Sep 17 00:00:00 2001 From: anishfyle Date: Fri, 20 Dec 2024 16:55:45 +0530 Subject: [PATCH] map_employees to export settings --- apps/workspaces/actions.py | 17 +++++++---------- apps/workspaces/models.py | 1 - apps/workspaces/signals.py | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/apps/workspaces/actions.py b/apps/workspaces/actions.py index 1c71534e..d1e70928 100644 --- a/apps/workspaces/actions.py +++ b/apps/workspaces/actions.py @@ -109,15 +109,12 @@ def connect_qbo_oauth(refresh_token, realm_id, workspace_id): workspace.qbo_realm_id = realm_id if workspace.onboarding_state == 'CONNECTION': - if settings.BRAND_ID == 'fyle': - workspace.onboarding_state = 'MAP_EMPLOYEES' - elif settings.BRAND_ID == 'co': - workspace.onboarding_state = 'EXPORT_SETTINGS' - workspace_general_settings_instance = WorkspaceGeneralSettings.objects.filter(workspace_id=workspace.id).first() - if not workspace_general_settings_instance: - WorkspaceGeneralSettings.objects.update_or_create( - workspace_id=workspace_id, defaults={'employee_field_mapping': 'VENDOR', 'auto_map_employees': None} - ) + workspace.onboarding_state = 'EXPORT_SETTINGS' + workspace_general_settings_instance = WorkspaceGeneralSettings.objects.filter(workspace_id=workspace.id).first() + if not workspace_general_settings_instance: + WorkspaceGeneralSettings.objects.update_or_create( + workspace_id=workspace_id, defaults={'employee_field_mapping': 'VENDOR', 'auto_map_employees': None} + ) workspace.save() @@ -208,7 +205,7 @@ def setup_e2e_tests(workspace_id: int, connection): platform.import_fyle_dimensions(import_taxes=True) # Reset workspace details - workspace.onboarding_state = 'MAP_EMPLOYEES' + workspace.onboarding_state = 'EXPORT_SETTINGS' workspace.source_synced_at = datetime.now() workspace.destination_synced_at = datetime.now() workspace.qbo_realm_id = healthy_token.realm_id diff --git a/apps/workspaces/models.py b/apps/workspaces/models.py index 95c4473e..84a64415 100644 --- a/apps/workspaces/models.py +++ b/apps/workspaces/models.py @@ -12,7 +12,6 @@ ONBOARDING_STATE_CHOICES = ( ('CONNECTION', 'CONNECTION'), - ('MAP_EMPLOYEES', 'MAP_EMPLOYEES'), ('EXPORT_SETTINGS', 'EXPORT_SETTINGS'), ('IMPORT_SETTINGS', 'IMPORT_SETTINGS'), ('ADVANCED_CONFIGURATION', 'ADVANCED_CONFIGURATION'), diff --git a/apps/workspaces/signals.py b/apps/workspaces/signals.py index 0272b513..6e173543 100644 --- a/apps/workspaces/signals.py +++ b/apps/workspaces/signals.py @@ -29,7 +29,7 @@ def post_delete_qbo_connection(workspace_id): :return: None """ workspace = Workspace.objects.get(id=workspace_id) - if workspace.onboarding_state in ('CONNECTION', 'MAP_EMPLOYEES', 'EXPORT_SETTINGS'): + if workspace.onboarding_state in ('CONNECTION', 'EXPORT_SETTINGS'): EmployeeMapping.objects.filter(workspace_id=workspace_id).delete() DestinationAttribute.objects.filter(workspace_id=workspace_id).delete() workspace.onboarding_state = 'CONNECTION'