From dd4995696afe60c34ab5d30a86da404c35c9b0a1 Mon Sep 17 00:00:00 2001 From: Hrishabh Tiwari <74908943+Hrishabh17@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:52:00 +0530 Subject: [PATCH] fix categories disable p0 bug (#666) * fix categories disable p0 bug * bump accounting_mapping version * update accounting mapping version * bump platform connector version * update submodule --- apps/quickbooks_online/utils.py | 6 +++++- fyle_integrations_imports | 2 +- requirements.txt | 4 ++-- .../test_modules/test_categories.py | 6 +++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/quickbooks_online/utils.py b/apps/quickbooks_online/utils.py index ad50a1ce..c4cd203b 100644 --- a/apps/quickbooks_online/utils.py +++ b/apps/quickbooks_online/utils.py @@ -186,8 +186,11 @@ def sync_accounts(self): accounts_generator = self.connection.accounts.get_all_generator() category_sync_version = 'v2' general_settings = WorkspaceGeneralSettings.objects.filter(workspace_id=self.workspace_id).first() + is_category_import_to_fyle_enabled = False + if general_settings: category_sync_version = general_settings.category_sync_version + is_category_import_to_fyle_enabled = general_settings.import_categories for accounts in accounts_generator: account_attributes = {'account': [], 'credit_card_account': [], 'bank_account': [], 'accounts_payable': []} @@ -254,7 +257,8 @@ def sync_accounts(self): self.workspace_id, True, attribute_type.title().replace('_', ' '), - attribute_disable_callback_path=ATTRIBUTE_CALLBACK_PATH.get(attribute_type.upper()) + attribute_disable_callback_path=ATTRIBUTE_CALLBACK_PATH.get(attribute_type.upper()), + is_import_to_fyle_enabled=is_category_import_to_fyle_enabled ) last_synced_time = get_last_synced_time(self.workspace_id, 'CATEGORY') diff --git a/fyle_integrations_imports b/fyle_integrations_imports index 576dfd46..e4c2de5f 160000 --- a/fyle_integrations_imports +++ b/fyle_integrations_imports @@ -1 +1 @@ -Subproject commit 576dfd4678d4b9c0d261543c8b64a926c4e3ff83 +Subproject commit e4c2de5f794ad34382a1c53631443b7439c6d73f diff --git a/requirements.txt b/requirements.txt index b7736c5d..77029bff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,8 +21,8 @@ django-sendgrid-v5==1.2.0 enum34==1.1.10 future==0.18.2 fyle==0.37.0 -fyle-accounting-mappings==1.34.2 -fyle-integrations-platform-connector==1.38.4 +fyle-accounting-mappings==1.34.4 +fyle-integrations-platform-connector==1.39.1 fyle-rest-auth==1.7.2 flake8==4.0.1 gevent==23.9.1 diff --git a/tests/test_fyle_integrations_imports/test_modules/test_categories.py b/tests/test_fyle_integrations_imports/test_modules/test_categories.py index f59413b6..b306e2ba 100644 --- a/tests/test_fyle_integrations_imports/test_modules/test_categories.py +++ b/tests/test_fyle_integrations_imports/test_modules/test_categories.py @@ -504,7 +504,7 @@ def test_disable_categories( mock_platform = mocker.patch('fyle_integrations_imports.modules.categories.PlatformConnector') bulk_post_call = mocker.patch.object(mock_platform.return_value.categories, 'post_bulk') - disable_categories(workspace_id, categories_to_disable) + disable_categories(workspace_id, categories_to_disable, is_import_to_fyle_enabled=True) assert bulk_post_call.call_count == 1 @@ -517,7 +517,7 @@ def test_disable_categories( } } - disable_categories(workspace_id, categories_to_disable) + disable_categories(workspace_id, categories_to_disable, is_import_to_fyle_enabled=True) assert bulk_post_call.call_count == 1 # Test disable category with code in naming @@ -550,7 +550,7 @@ def test_disable_categories( 'id': 'source_id_123' }] - bulk_payload = disable_categories(workspace_id, categories_to_disable) + bulk_payload = disable_categories(workspace_id, categories_to_disable, is_import_to_fyle_enabled=True) assert bulk_payload == payload