Skip to content

Commit

Permalink
Fix: Adding default ccc bank account
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh619-sudo committed Dec 11, 2024
1 parent 1679d80 commit bb16404
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/business_central/exports/journal_entry/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ def create_or_update_object(self, accounting_export: AccountingExport, _: Advanc
:return: purchase invoices object
"""
expense = accounting_export.expenses.first()

accounts_payable_account_id = export_settings.default_bank_account_id

if expense.fund_source == 'CCC':
accounts_payable_account_id = export_settings.default_CCC_bank_account_id

advance_setting = AdvancedSetting.objects.get(workspace_id=accounting_export.workspace_id)

document_number = expense.expense_number
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.1.2 on 2024-12-11 10:37

from django.db import migrations
import ms_business_central_api.models.fields


class Migration(migrations.Migration):

dependencies = [
('workspaces', '0004_importsetting_charts_of_accounts'),
]

operations = [
migrations.AddField(
model_name='exportsetting',
name='default_CCC_bank_account_id',
field=ms_business_central_api.models.fields.StringNullField(help_text='CCC Bank Account ID', max_length=255, null=True),
),
migrations.AddField(
model_name='exportsetting',
name='default_CCC_bank_account_name',
field=ms_business_central_api.models.fields.StringNullField(help_text='CCC Bank account name', max_length=255, null=True),
),
]
2 changes: 2 additions & 0 deletions apps/workspaces/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ class ExportSetting(BaseModel):
)
default_bank_account_name = StringNullField(help_text='Bank account name')
default_bank_account_id = StringNullField(help_text='Bank Account ID')
default_CCC_bank_account_name = StringNullField(help_text='CCC Bank account name')
default_CCC_bank_account_id = StringNullField(help_text='CCC Bank Account ID')
reimbursable_expense_state = StringOptionsField(
choices=REIMBURSABLE_EXPENSE_STATE_CHOICES
)
Expand Down

0 comments on commit bb16404

Please sign in to comment.