-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add unit tests for split expense grouping and update existing f…
…ixtures (#401) * test: add unit tests for split expense grouping and update existing fixtures * refactor: lint * feat: add `split_expense_grouping` to the expense group settings serializer (#404) * feat: add `split_expense_grouping` to the expense group settings serializer * feat: implement split expense grouping functionality (#405) * feat: implement split expense grouping functionality * fix: skip only `expense_id` and `expense_number` while grouping while defining the fields to group split expenses by, skip only `expense_id` and `expense_number`, NOT `spent_at` or `posted_at` * feat: add script for split expense grouping (#406) Set the default split expense grouping config to `SINGLE_LINE_ITEM` for all old orgs
- Loading branch information
1 parent
4177e1a
commit 0b487e5
Showing
9 changed files
with
371 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
sql/scripts/027-default-split-expense-grouping-for-old-orgs.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
rollback; | ||
begin; | ||
|
||
UPDATE expense_group_settings | ||
SET split_expense_grouping = 'SINGLE_LINE_ITEM'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -236,7 +236,8 @@ | |
'tax_amount': None, | ||
'tax_group_id': None, | ||
'previous_export_state': None, | ||
'accounting_export_summary': [] | ||
'accounting_export_summary': [], | ||
"bank_transaction_id": None, | ||
}, | ||
"expenses": [ | ||
{ | ||
|
@@ -278,8 +279,189 @@ | |
"Vehicle Type": "", | ||
"Fyle Categories": "", | ||
}, | ||
"bank_transaction_id": None, | ||
}, | ||
], | ||
|
||
"ccc_split_expenses": [ | ||
{ | ||
"id": 15133, | ||
"employee_email": "[email protected]", | ||
"employee_name": "Theresa Brown", | ||
"category": "Food", | ||
"sub_category": None, | ||
"project": "Project 8", | ||
"org_id": "oryoUx39Vz66", | ||
"expense_number": "E/2024/11/T/7", | ||
"claim_number": "C/2024/11/R/3", | ||
"amount": 21.208, | ||
"currency": "USD", | ||
"foreign_amount": None, | ||
"foreign_currency": None, | ||
"settlement_id": None, | ||
"reimbursable": False, | ||
"state": "APPROVED", | ||
"vendor": "Dominos Pizza", | ||
"cost_center": None, | ||
"corporate_card_id": "baccZ5Ww7s9mLu", | ||
"purpose": None, | ||
"report_id": "rprwO90Ul12E", | ||
"billable": False, | ||
"file_ids": [], | ||
"spent_at": '2024-11-04T00:00:00Z', | ||
"approved_at": '2024-11-04T15:45:02.657341Z', | ||
"posted_at": None, | ||
"expense_created_at": '2024-11-04T15:44:46.752178Z', | ||
"expense_updated_at": '2024-11-04T15:45:02.487787Z', | ||
"created_at": '2024-11-07T20:20:05.416618Z', | ||
"updated_at": '2024-11-07T20:20:05.416629Z', | ||
"fund_source": "CCC", | ||
"verified_at": None, | ||
"custom_properties": {"Custom Expense Field": None}, | ||
"paid_on_xero": False, | ||
"paid_on_fyle": False, | ||
"tax_amount": 0.0, | ||
"tax_group_id": None, | ||
"accounting_export_summary": {}, | ||
"previous_export_state": None, | ||
"workspace_id": 399, | ||
"source_account_type": "PERSONAL_CORPORATE_CREDIT_CARD_ACCOUNT", | ||
"bank_transaction_id": "btxnQe02cfpD9n" | ||
}, | ||
{ | ||
"id": 15134, | ||
"employee_email": "[email protected]", | ||
"employee_name": "Theresa Brown", | ||
"category": "Food", | ||
"sub_category": None, | ||
"project": "Project 10", | ||
"org_id": "oryoUx39Vz66", | ||
"expense_number": "E/2024/11/T/6", | ||
"claim_number": "C/2024/11/R/3", | ||
"amount": 31.812, | ||
"currency": "USD", | ||
"foreign_amount": None, | ||
"foreign_currency": None, | ||
"settlement_id": None, | ||
"reimbursable": False, | ||
"state": "APPROVED", | ||
"vendor": "Dominos Pizza", | ||
"cost_center": None, | ||
"corporate_card_id": "baccZ5Ww7s9mLu", | ||
"purpose": None, | ||
"report_id": "rprwO90Ul12E", | ||
"billable": False, | ||
"file_ids": [], | ||
"spent_at": '2024-11-04T00:00:00Z', | ||
"approved_at": '2024-11-04T15:45:02.657341Z', | ||
"posted_at": None, | ||
"expense_created_at": '2024-11-04T15:44:46.581967Z', | ||
"expense_updated_at": '2024-11-04T15:45:02.283785Z', | ||
"created_at": '2024-11-07T20:20:05.438423Z', | ||
"updated_at": '2024-11-07T20:20:05.438431Z', | ||
"fund_source": "CCC", | ||
"verified_at": None, | ||
"custom_properties": {"Custom Expense Field": None}, | ||
"paid_on_xero": False, | ||
"paid_on_fyle": False, | ||
"tax_amount": 0.0, | ||
"tax_group_id": None, | ||
"accounting_export_summary": {}, | ||
"previous_export_state": None, | ||
"workspace_id": 399, | ||
"source_account_type": "PERSONAL_CORPORATE_CREDIT_CARD_ACCOUNT", | ||
"bank_transaction_id": "btxnQe02cfpD9n" | ||
}, | ||
{ | ||
"id": 15135, | ||
"employee_email": "[email protected]", | ||
"employee_name": "Theresa Brown", | ||
"category": "Food", | ||
"sub_category": None, | ||
"project": "Project 10", | ||
"org_id": "oryoUx39Vz66", | ||
"expense_number": "E/2024/11/T/8", | ||
"claim_number": "C/2024/11/R/3", | ||
"amount": 23.492, | ||
"currency": "USD", | ||
"foreign_amount": None, | ||
"foreign_currency": None, | ||
"settlement_id": None, | ||
"reimbursable": False, | ||
"state": "APPROVED", | ||
"vendor": "Dominos Pizza", | ||
"cost_center": None, | ||
"corporate_card_id": "baccZ5Ww7s9mLu", | ||
"purpose": None, | ||
"report_id": "rprwO90Ul12E", | ||
"billable": False, | ||
"file_ids": [], | ||
"spent_at": '2024-11-04T00:00:00Z', | ||
"approved_at": '2024-11-04T15:45:02.657341Z', | ||
"posted_at": None, | ||
"expense_created_at": '2024-11-04T15:44:46.581967Z', | ||
"expense_updated_at": '2024-11-04T15:45:02.283785Z', | ||
"created_at": '2024-11-07T20:20:05.438423Z', | ||
"updated_at": '2024-11-07T20:20:05.438431Z', | ||
"fund_source": "CCC", | ||
"verified_at": None, | ||
"custom_properties": {"Custom Expense Field": None}, | ||
"paid_on_xero": False, | ||
"paid_on_fyle": False, | ||
"tax_amount": 0.0, | ||
"tax_group_id": None, | ||
"accounting_export_summary": {}, | ||
"previous_export_state": None, | ||
"workspace_id": 399, | ||
"source_account_type": "PERSONAL_CORPORATE_CREDIT_CARD_ACCOUNT", | ||
"bank_transaction_id": "btxnQe02cfpD9n" | ||
}, | ||
{ | ||
"id": 15136, | ||
"employee_email": "[email protected]", | ||
"employee_name": "Theresa Brown", | ||
"category": "Food", | ||
"sub_category": None, | ||
"project": "Project 10", | ||
"org_id": "oryoUx39Vz66", | ||
"expense_number": "E/2024/11/T/9", | ||
"claim_number": "C/2024/11/R/3", | ||
"amount": 26.722, | ||
"currency": "USD", | ||
"foreign_amount": None, | ||
"foreign_currency": None, | ||
"settlement_id": None, | ||
"reimbursable": False, | ||
"state": "APPROVED", | ||
"vendor": "Dominos Pizza", | ||
"cost_center": None, | ||
"corporate_card_id": "baccZ5Ww7s9mLu", | ||
"purpose": None, | ||
"report_id": "rprwO90Ul12E", | ||
"billable": False, | ||
"file_ids": [], | ||
"spent_at": '2024-11-04T00:00:00Z', | ||
"approved_at": '2024-11-04T15:45:02.657341Z', | ||
"posted_at": None, | ||
"expense_created_at": '2024-11-04T15:44:46.581967Z', | ||
"expense_updated_at": '2024-11-04T15:45:02.283785Z', | ||
"created_at": '2024-11-07T20:20:05.438423Z', | ||
"updated_at": '2024-11-07T20:20:05.438431Z', | ||
"fund_source": "CCC", | ||
"verified_at": None, | ||
"custom_properties": {"Custom Expense Field": None}, | ||
"paid_on_xero": False, | ||
"paid_on_fyle": False, | ||
"tax_amount": 0.0, | ||
"tax_group_id": None, | ||
"accounting_export_summary": {}, | ||
"previous_export_state": None, | ||
"workspace_id": 399, | ||
"source_account_type": "PERSONAL_CORPORATE_CREDIT_CARD_ACCOUNT", | ||
"bank_transaction_id": "btxnQe02cfpD9n" | ||
}, | ||
], | ||
|
||
"eliminated_expenses": [ | ||
{ | ||
"id": "tx6wOnBVaumk", | ||
|
@@ -320,6 +502,7 @@ | |
"Vehicle Type": "", | ||
"Fyle Categories": "", | ||
}, | ||
"bank_transaction_id": None, | ||
} | ||
], | ||
"expense_group_id": { | ||
|
@@ -366,6 +549,7 @@ | |
"import_card_credits": "false", | ||
"created_at": "2021-11-15T08:46:16.069944Z", | ||
"updated_at": "2021-11-15T08:46:16.069986Z", | ||
"split_expense_grouping": "MULTIPLE_LINE_ITEM", | ||
"workspace": 1, | ||
}, | ||
"reimbursements": [ | ||
|
@@ -396,6 +580,7 @@ | |
"ccc_expense_state": "PAYMENT_PROCESSING", | ||
"reimbursable_export_date_type": "spent_at", | ||
"ccc_export_date_type": "spent_at", | ||
"split_expense_grouping": "MULTIPLE_LINE_ITEM", | ||
}, | ||
"expense_fields_response": [ | ||
{"attribute_type": "COST_CENTER", "display_name": "Cost Center"}, | ||
|
@@ -594,6 +779,7 @@ | |
"paid_on_xero": False, | ||
"tax_amount": "None", | ||
"tax_group_id": "None", | ||
"bank_transaction_id": None, | ||
} | ||
], | ||
"fund_source": "PERSONAL", | ||
|
Oops, something went wrong.