Skip to content

Commit

Permalink
reimbursable expense field set journal entry
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyanshs7 committed Sep 12, 2024
1 parent 0e06bbc commit 5f33e7a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/spotlight/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def _get_action_function_from_code(cls, *, code: str) -> Callable:
code_to_function_map = {
"trigger_export": cls.trigger_export,
"set_reimbursable_expenses_export_module_bill": cls.set_reimbursable_expenses_export_module_bill,
"set_reimbursable_expenses_export_module_journal_entry": cls.set_reimbursable_expenses_export_module_journal_entry,
"set_customer_field_mapping_to_project": cls.set_customer_field_mapping_to_project,
"set_customer_field_mapping_to_cost_center": cls.set_customer_field_mapping_to_cost_center,
"set_class_field_mapping_to_project": cls.set_class_field_mapping_to_project,
Expand Down Expand Up @@ -99,6 +100,19 @@ def set_reimbursable_expenses_export_module_bill(cls, *, workspace_id: int):
export_settings.save()
return ActionResponse(message="Reimbursable expense export type set to Bill", is_success=True)

@classmethod
def set_reimbursable_expenses_export_module_journal_entry(cls, *, workspace_id: int):
with transaction.atomic():
export_settings = ExportSettings.objects.filter(
workspace_id=workspace_id
).first()
if export_settings is None:
return ActionResponse(message="Failed to set reimbursable expense export type set to Journal Entry", is_success=False)
else:
export_settings.reimbursable_expenses_export_type = 'JOURNAL_ENTRY'
export_settings.save()
return ActionResponse(message="Reimbursable expense export type set to Journal Entry", is_success=True)

@classmethod
def trigger_export(cls, *, workspace_id: int):
access_token = cls.get_access_token(workspace_id=workspace_id)
Expand Down

0 comments on commit 5f33e7a

Please sign in to comment.