Skip to content

Commit

Permalink
fix categories disable p0 bug (#666)
Browse files Browse the repository at this point in the history
* fix categories disable p0 bug

* bump accounting_mapping version

* update accounting mapping version

* bump platform connector version

* update submodule
  • Loading branch information
Hrishabh17 authored Sep 18, 2024
1 parent e07a88b commit dd49956
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion apps/quickbooks_online/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': []}
Expand Down Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion fyle_integrations_imports
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit dd49956

Please sign in to comment.