Skip to content

Commit

Permalink
Fix: Purpose Char Limit (#159)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Actions <[email protected]>
  • Loading branch information
ruuushhh and GitHub Actions authored Jul 31, 2024
1 parent 96f3df8 commit dc9dc05
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/business_central/exports/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,18 @@ def get_vendor_or_employee_id(employee_field_mapping: str, mapping: EmployeeMapp

def get_expense_purpose(lineitem: Expense, category: str, advance_setting: AdvancedSetting) -> str:
memo_structure = advance_setting.expense_memo_structure
lineitem_purpose = ''

if lineitem.purpose and len(lineitem.purpose) > 40:
lineitem_purpose = lineitem.purpose[:37] + '...'
else:
lineitem_purpose = lineitem.purpose

details = {
'employee_email': lineitem.employee_email,
'merchant': '{0}'.format(lineitem.vendor) if lineitem.vendor else '',
'category': '{0}'.format(category) if lineitem.category else '',
'purpose': '{0}'.format(lineitem.purpose) if lineitem.purpose else '',
'purpose': '{0}'.format(lineitem_purpose),
'report_number': '{0}'.format(lineitem.claim_number),
'spent_on': '{0}'.format(lineitem.spent_at.date()) if lineitem.spent_at else '',
}
Expand Down

0 comments on commit dc9dc05

Please sign in to comment.