Skip to content

Commit

Permalink
map_employees to export settings
Browse files Browse the repository at this point in the history
  • Loading branch information
anishfyle committed Dec 20, 2024
1 parent b03b3e1 commit 0db881a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
17 changes: 7 additions & 10 deletions apps/workspaces/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion apps/workspaces/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion apps/workspaces/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 0db881a

Please sign in to comment.