Skip to content

Commit

Permalink
Merge branch 'master' into last_export_module
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh619-sudo committed Nov 20, 2023
2 parents a362361 + 07ecdcd commit 2f8ba6d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions apps/mappings/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def create_fyle_categories_payload(categories: List[DestinationAttribute], categ
'id': category.source_id,
'name': category.value,
'code': destination_id_of_category,
'is_enabled': category.active
'is_enabled': category.active if category.value != 'Unspecified' else True
})
else:
for category in categories:
Expand Down Expand Up @@ -226,8 +226,8 @@ def upload_categories_to_fyle(workspace_id: int, configuration: Configuration, p
if configuration.import_categories:
netsuite_accounts = DestinationAttribute.objects.filter(
workspace_id=workspace_id,
attribute_type='EXPENSE_CATEGORY' if configuration.reimbursable_expenses_object == 'EXPENSE_REPORT' or configuration.corporate_credit_card_expenses_object == 'EXPENSE_REPORT' else 'ACCOUNT',
display_name='Expense Category' if configuration.reimbursable_expenses_object == 'EXPENSE_REPORT' or configuration.corporate_credit_card_expenses_object == 'EXPENSE_REPORT' else 'Account'
attribute_type='EXPENSE_CATEGORY' if configuration.reimbursable_expenses_object == 'EXPENSE REPORT' or configuration.corporate_credit_card_expenses_object == 'EXPENSE REPORT' else 'ACCOUNT',
display_name='Expense Category' if configuration.reimbursable_expenses_object == 'EXPENSE REPORT' or configuration.corporate_credit_card_expenses_object == 'EXPENSE REPORT' else 'Account'
)
if netsuite_accounts:
netsuite_attributes = netsuite_accounts
Expand Down Expand Up @@ -480,7 +480,7 @@ def auto_create_category_mappings(workspace_id):
employee_field_mapping = configuration.employee_field_mapping
corporate_credit_card_expenses_object = configuration.corporate_credit_card_expenses_object

if configuration.reimbursable_expenses_object == 'EXPENSE_REPORT' or configuration.corporate_credit_card_expenses_object == 'EXPENSE_REPORT':
if configuration.reimbursable_expenses_object == 'EXPENSE REPORT' or configuration.corporate_credit_card_expenses_object == 'EXPENSE REPORT':
reimbursable_destination_type = 'EXPENSE_CATEGORY'
else:
reimbursable_destination_type = 'ACCOUNT'
Expand Down
4 changes: 2 additions & 2 deletions tests/test_fyle/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def test_update_import_card_credits_flag():
expense_group_setting = ExpenseGroupSettings.objects.get(id=1)
assert expense_group_setting.import_card_credits == True

update_import_card_credits_flag('BILL', 'EXPENSE_REPORT', 1)
update_import_card_credits_flag('BILL', 'EXPENSE REPORT', 1)
expense_group_setting = ExpenseGroupSettings.objects.get(id=1)
assert expense_group_setting.import_card_credits == False
assert expense_group_setting.import_card_credits == True


@pytest.mark.django_db()
Expand Down
6 changes: 3 additions & 3 deletions tests/test_mappings/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def test_upload_categories_to_fyle(mocker, db):

assert expense_category_count == 36

assert len(netsuite_attributes) == 137
assert len(netsuite_attributes) == 36

count_of_accounts = DestinationAttribute.objects.filter(
attribute_type='ACCOUNT', workspace_id=49).count()
Expand Down Expand Up @@ -338,7 +338,7 @@ def test_filter_unmapped_destinations(db, mocker):
netsuite_attributes = upload_categories_to_fyle(workspace_id=1,configuration=configuration, platform=platform)

destination_attributes = filter_unmapped_destinations('EXPENSE_CATEGORY', netsuite_attributes)
assert len(destination_attributes) == 124
assert len(destination_attributes) == 33


def test_schedule_creation(db):
Expand Down Expand Up @@ -389,7 +389,7 @@ def test_auto_create_category_mappings(db, mocker):
assert response == None

mappings_count = CategoryMapping.objects.filter(workspace_id=1).count()
assert mappings_count == 122
assert mappings_count == 34

configuration = Configuration.objects.get(workspace_id=49)
configuration.reimbursable_expenses_object = 'BILL'
Expand Down
4 changes: 2 additions & 2 deletions tests/test_netsuite/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ def test_process_vendor_payment_expense_report(mocker, db):
code='INVALID_KEY_OR_REF',
message='An error occured in a upsert request: Invalid apacct reference key 223.'
)
process_vendor_payment(entity_object, 49, 'EXPENSE_REPORT')
process_vendor_payment(entity_object, 49, 'EXPENSE REPORT')

task_log = TaskLog.objects.filter(workspace_id=49, type='CREATING_VENDOR_PAYMENT').last()

Expand All @@ -1217,7 +1217,7 @@ def test_process_vendor_payment_expense_report(mocker, db):
return_value=data['create_vendor_payment']
)

process_vendor_payment(entity_object, 49, 'EXPENSE_REPORT')
process_vendor_payment(entity_object, 49, 'EXPENSE REPORT')

task_log = TaskLog.objects.get(workspace_id=49, type='CREATING_VENDOR_PAYMENT')
assert task_log.status == 'COMPLETE'
Expand Down
4 changes: 2 additions & 2 deletions tests/test_workspaces/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"id":1,
"workspace":"Workspace object (1)",
"employee_field_mapping":"EMPLOYEE",
"reimbursable_expenses_object":"EXPENSE_REPORT",
"corporate_credit_card_expenses_object":"EXPENSE_REPORT",
"reimbursable_expenses_object":"EXPENSE REPORT",
"corporate_credit_card_expenses_object":"EXPENSE REPORT",
"import_categories":true,
"import_tax_items":false,
"import_projects":true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
'response': {
'configuration': {
'reimbursable_expenses_object': 'EXPENSE_REPORT',
'reimbursable_expenses_object': 'EXPENSE REPORT',
'corporate_credit_card_expenses_object': 'CHARGE_CARD_TRANSACTION',
'is_simplify_report_closure_enabled': False,
},
Expand Down Expand Up @@ -133,7 +133,7 @@
},
'export_settings_missing_values_expense_group_settings': {
'configurations': {
'reimbursable_expenses_object': 'EXPENSE_REPORT',
'reimbursable_expenses_object': 'EXPENSE REPORT',
'corporate_credit_card_expenses_object': 'CHARGE_CARD_TRANSACTION',
'is_simplify_report_closure_enabled': False,
},
Expand All @@ -159,7 +159,7 @@
},
'export_settings_missing_values_general_mappings': {
'configurations': {
'reimbursable_expenses_object': 'EXPENSE_REPORT',
'reimbursable_expenses_object': 'EXPENSE REPORT',
'corporate_credit_card_expenses_object': 'CHARGE_CARD_TRANSACTION',
'is_simplify_report_closure_enabled': False,
},
Expand Down

0 comments on commit 2f8ba6d

Please sign in to comment.