Skip to content

Commit

Permalink
add bank_transaction_id in ALLOWED_FIELDS (#654)
Browse files Browse the repository at this point in the history
* add bank_transaction_id in ALLOWED_FIELDS

* updated fixtures and test

* updated fixtures

* updated fixtures
  • Loading branch information
anishfyle committed Jul 23, 2024
1 parent 8ab24fd commit c80aaf5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion apps/fyle/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from apps.workspaces.models import Workspace, WorkspaceGeneralSettings
from apps.workspaces.utils import round_amount

ALLOWED_FIELDS = ['employee_email', 'report_id', 'claim_number', 'settlement_id', 'fund_source', 'vendor', 'category', 'project', 'cost_center', 'verified_at', 'approved_at', 'spent_at', 'expense_id', 'posted_at']
ALLOWED_FIELDS = ['employee_email', 'report_id', 'claim_number', 'settlement_id', 'fund_source', 'vendor', 'category', 'project', 'cost_center', 'verified_at', 'approved_at', 'spent_at', 'expense_id', 'posted_at', 'bank_transaction_id']

ALLOWED_FORM_INPUT = {'group_expenses_by': ['settlement_id', 'claim_number', 'report_id', 'category', 'vendor', 'expense_id'], 'export_date_type': ['current_date', 'approved_at', 'spent_at', 'verified_at', 'last_spent_at', 'posted_at']}

Expand Down
38 changes: 21 additions & 17 deletions tests/test_fyle/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,11 +1144,12 @@
'paid_on_qbo': False,
'created_at': '2024-06-18T19:12:17.003409+00:00',
'updated_at': '2024-06-18T19:12:17.003421+00:00',
'bank_transaction_id': 'Arkham'
'bank_transaction_id': 'Arkham',
'fund_source': 'CCC'
},
{
'id': '24004',
'employee_email': 'admin21@fyleforbamboohr.com',
'employee_email': 'admin11@fyleforbamboohr.com',
'employee_name': 'Theresa Brown',
'report_title': '#1: Aug 2024',
'category': 'Taxi',
Expand All @@ -1171,15 +1172,15 @@
'state': 'APPROVED',
'vendor': None,
'cost_center': 'F & A',
'corporate_card_id': None,
'corporate_card_id': 'baccOhXVSIlP7S',
'purpose': None,
'report_id': 'rp6lAwelLh54',
'file_ids': [],
'spent_at': '2024-06-05T00:00:00+00:00',
'posted_at': None,
'approved_at': '2024-06-05T12:35:28.453+00:00',
'expense_created_at': '2024-06-05T12:34:41.770252+00:00',
'expense_updated_at': '2024-06-10T11:45:09.305064+00:00',
'expense_created_at': '2024-06-05T12:34:09.350864+00:00',
'expense_updated_at': '2024-06-10T11:45:43.338229+00:00',
'source_account_type': 'PERSONAL_CORPORATE_CREDIT_CARD_ACCOUNT',
'verified_at': None,
'custom_properties': {
Expand All @@ -1193,13 +1194,14 @@
'previous_export_state': None,
'paid_on_fyle': False,
'paid_on_qbo': False,
'created_at': '2024-06-18T19:12:17.020617+00:00',
'updated_at': '2024-06-18T19:12:17.020627+00:00',
'bank_transaction_id': 'Arkham'
'created_at': '2024-06-18T19:12:17.003409+00:00',
'updated_at': '2024-06-18T19:12:17.003421+00:00',
'bank_transaction_id': 'Arkham',
'fund_source': 'CCC'
},
{
'id': '24008',
'employee_email': 'admin1@fyleforbamboohr.com',
'employee_email': 'admin11@fyleforbamboohr.com',
'employee_name': 'Theresa Brown',
'report_title': '#1: Jun 2024',
'category': 'Taxi',
Expand Down Expand Up @@ -1243,11 +1245,12 @@
'paid_on_qbo': False,
'created_at': '2024-06-18T19:12:17.003409+00:00',
'updated_at': '2024-06-18T19:12:17.003421+00:00',
'bank_transaction_id': 'Anish'
'bank_transaction_id': 'Anish',
'fund_source': 'CCC'
},
{
'id': '24009',
'employee_email': 'admin1@fyleforbamboohr.com',
'employee_email': 'admin11@fyleforbamboohr.com',
'employee_name': 'Theresa Brown',
'report_title': '#1: Jun 2024',
'category': 'Taxi',
Expand All @@ -1270,15 +1273,15 @@
'state': 'APPROVED',
'vendor': None,
'cost_center': 'F & A',
'corporate_card_id': None,
'corporate_card_id': 'baccOhXVSIlP7S',
'purpose': None,
'report_id': 'rp6lAwelLh54',
'file_ids': [],
'spent_at': '2024-06-05T00:00:00+00:00',
'posted_at': None,
'approved_at': '2024-06-05T12:35:28.453+00:00',
'expense_created_at': '2024-06-05T12:34:41.770252+00:00',
'expense_updated_at': '2024-06-10T11:45:09.305064+00:00',
'expense_created_at': '2024-06-05T12:34:09.350864+00:00',
'expense_updated_at': '2024-06-10T11:45:43.338229+00:00',
'source_account_type': 'PERSONAL_CORPORATE_CREDIT_CARD_ACCOUNT',
'verified_at': None,
'custom_properties': {
Expand All @@ -1292,9 +1295,10 @@
'previous_export_state': None,
'paid_on_fyle': False,
'paid_on_qbo': False,
'created_at': '2024-06-18T19:12:17.020617+00:00',
'updated_at': '2024-06-18T19:12:17.020627+00:00',
'bank_transaction_id': 'Anish'
'created_at': '2024-06-18T19:12:17.003409+00:00',
'updated_at': '2024-06-18T19:12:17.003421+00:00',
'bank_transaction_id': 'Anish',
'fund_source': 'CCC'
}
],
'expense_groups_complete_response': {
Expand Down
6 changes: 3 additions & 3 deletions tests/test_fyle/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,14 +388,14 @@ def test_split_expenses_diff_bank_transaction_id(db):
expense_objects = Expense.create_expense_objects(expenses, 1)
assert len(expense_objects) == 4

expense_groups = _group_expenses(expense_objects, ['expense_id', 'fund_source', 'employee_email', 'spent_at'], 4)
expense_groups = _group_expenses(expense_objects, ['expense_id', 'fund_source', 'employee_email', 'spent_at', 'bank_transaction_id'], 4)
assert len(expense_groups) == 4

expense_group_settings.split_expense_grouping = 'MULTIPLE_LINE_ITEM'
expense_group_settings.save()

expense_groups = _group_expenses(expense_objects, ['expense_id', 'fund_source', 'employee_email', 'spent_at'], 4)
assert len(expense_groups) == 4
expense_groups = _group_expenses(expense_objects, ['fund_source', 'employee_email', 'spent_at', 'bank_transaction_id'], 4)
assert len(expense_groups) == 2


def test_format_date():
Expand Down

0 comments on commit c80aaf5

Please sign in to comment.