Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix categories disable p0 bug #666

Merged
merged 5 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading