From f77a41a2f5146dab43e380cbd5bb44291cc9b268 Mon Sep 17 00:00:00 2001 From: Ashwin Thanaraj <37061471+ashwin1111@users.noreply.github.com> Date: Wed, 27 Dec 2023 20:52:39 +0530 Subject: [PATCH] Handle refresh dimension safely for new customers (#548) --- apps/quickbooks_online/actions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/quickbooks_online/actions.py b/apps/quickbooks_online/actions.py index d4785458..c36387d1 100644 --- a/apps/quickbooks_online/actions.py +++ b/apps/quickbooks_online/actions.py @@ -67,12 +67,12 @@ def refresh_quickbooks_dimensions(workspace_id: int): mapping_settings = MappingSetting.objects.filter(workspace_id=workspace_id, import_to_fyle=True) credentials = QBOCredential.objects.get(workspace_id=workspace_id) - workspace_general_settings = WorkspaceGeneralSettings.objects.get(workspace_id=workspace_id) + workspace_general_settings = WorkspaceGeneralSettings.objects.filter(workspace_id=workspace_id).first() chain = Chain() for mapping_setting in mapping_settings: - if mapping_setting.source_field in ['PROJECT', 'COST_CENTER'] or mapping_setting.is_custom: + if workspace_general_settings and mapping_setting.source_field in ['PROJECT', 'COST_CENTER'] or mapping_setting.is_custom: chain.append( 'fyle_integrations_imports.tasks.trigger_import_via_schedule', workspace_id,