-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add auto create vendor feature (#533)
* add auto create vendor feature * sanitize the vendor name * fix filter * Fix JE auto-create vendor * call sage-connector once, move func back to tasks
- Loading branch information
1 parent
3efe15c
commit 1ceaad5
Showing
14 changed files
with
223 additions
and
59 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
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
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
18 changes: 18 additions & 0 deletions
18
apps/workspaces/migrations/0035_configuration_auto_create_merchants_as_vendors.py
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,18 @@ | ||
# Generated by Django 3.2.14 on 2024-07-26 17:19 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('workspaces', '0034_configuration_is_journal_credit_billable'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='configuration', | ||
name='auto_create_merchants_as_vendors', | ||
field=models.BooleanField(default=False, help_text='Auto create merchants as vendors in sage intacct'), | ||
), | ||
] |
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
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 |
---|---|---|
|
@@ -82,7 +82,7 @@ def test_expense_report(db): | |
logger.info('General mapping not found') | ||
|
||
|
||
def test_create_journal_entry(db, create_expense_group_expense, create_cost_type, create_dependent_field_setting): | ||
def test_create_journal_entry(db, mocker, create_expense_group_expense, create_cost_type, create_dependent_field_setting): | ||
workspace_id = 1 | ||
|
||
expense_group = ExpenseGroup.objects.get(id=2) | ||
|
@@ -94,7 +94,9 @@ def test_create_journal_entry(db, create_expense_group_expense, create_cost_type | |
general_mappings.save() | ||
|
||
journal_entry = JournalEntry.create_journal_entry(expense_group) | ||
journal_entry_lineitems = JournalEntryLineitem.create_journal_entry_lineitems(expense_group, workspace_general_settings) | ||
sage_intacct_connection = mocker.patch('apps.sage_intacct.utils.SageIntacctConnector') | ||
sage_intacct_connection.return_value = mocker.Mock() | ||
journal_entry_lineitems = JournalEntryLineitem.create_journal_entry_lineitems(expense_group, workspace_general_settings, sage_intacct_connection) | ||
|
||
for journal_entry_lineitem in journal_entry_lineitems: | ||
assert journal_entry_lineitem.amount == 11.0 | ||
|
@@ -105,7 +107,7 @@ def test_create_journal_entry(db, create_expense_group_expense, create_cost_type | |
|
||
try: | ||
general_mappings.delete() | ||
journal_entry_lineitems = JournalEntryLineitem.create_journal_entry_lineitems(expense_group, workspace_general_settings) | ||
journal_entry_lineitems = JournalEntryLineitem.create_journal_entry_lineitems(expense_group, workspace_general_settings, sage_intacct_connection) | ||
except: | ||
logger.info('General mapping not found') | ||
|
||
|
@@ -132,6 +134,8 @@ def test_create_charge_card_transaction(mocker, db, create_expense_group_expense | |
) | ||
workspace_id = 1 | ||
|
||
configuration = Configuration.objects.get(workspace_id=workspace_id) | ||
|
||
expense_group = ExpenseGroup.objects.get(id=1) | ||
expense_group.description.update({'employee_email': '[email protected]'}) | ||
expense_group.save() | ||
|
@@ -143,7 +147,7 @@ def test_create_charge_card_transaction(mocker, db, create_expense_group_expense | |
general_mappings.save() | ||
|
||
merchant = expense_group.expenses.first().vendor | ||
vendor = get_or_create_credit_card_vendor(merchant, expense_group.workspace_id) | ||
vendor = get_or_create_credit_card_vendor(expense_group.workspace_id, configuration, merchant) | ||
|
||
charge_card_transaction = ChargeCardTransaction.create_charge_card_transaction(expense_group, vendor.destination_id) | ||
workspace_general_settings = Configuration.objects.get(workspace_id=workspace_id) | ||
|
Oops, something went wrong.