Skip to content

[Merge] Auto-select Split expense amount when merging split expenses #70373

@garrettmknight

Description

@garrettmknight

Part of the Merge expense project

Main issue: https://github.com/Expensify/Expensify/issues/496985
Doc section: https://docs.google.com/document/d/1RXJyOVsX2AgKWNViLSxNm3PH2bSnJCuo6K_jcOxUGuo/edit?tab=t.0#bookmark=id.9mx7ug4mnp36

Feature Description

To avoid creating splits of an expense whose sum is more than the original transaction amount, we'll automatically keep the split transaction and default to the split amount and currency for the merged expense. Our card transaction defaults will supersede this logic.

Manual Test Steps

Split + Cash expense:

  1. Submitter creates a cash expense A, and categorizes it as Meals and adds it to Report 1
  2. Submitter creates a cash expense B, and categorizes it as Travel and adds it to Report 2
  3. Submitter splits cash expense B into C and D
  4. Submitter opens split C and taps More > Merge
  5. Submitter selects expense A
  6. Submitter can select the category since they differ, they select Travel
  7. Submitter can select the report since they differ, they select Report 2
  8. We automatically select the amount, currency and keep the transaction from Split C
  9. Submitter confirms:
  • Cash expense A is deleted
  • The amount, currency and transaction from Split C remain, including the original transaction ID so we can identify it as a split
  • The category is update to Travel
  • Split C is effectively moved to Report 2

Split + Card expense:

  1. Submitter has a company card imported, one transaction imports (expense A), and categorizes it as Meals and adds it to Report 1
  2. Submitter creates a cash expense B, and categorizes it as Travel and adds it to Report 2
  3. Submitter splits cash expense into C and D
  4. Submitter opens split C and taps More > Merge
  5. Submitter selects card expense A
  6. Submitter can select the category since they differ; they select Travel
  7. Submitter can select the report since they differ; they select Report 2
  8. We automatically select the amount, currency and keep the transaction from card expense A
  9. Submitter confirms:
  • Split expense C is deleted. This means that Split D is the only split. Note: We need to figure out if this will handle. It might trigger a revert to the original expense for Split D. Discussing here, but doesn't matter for this issue.
  • The amount, currency, and transaction from card expense A remain
  • The category is updated to Travel
  • Card expense A is effectively moved to Report 2

Automated Tests

Metadata

Metadata

Labels

Type

No type

Projects

Status

HIGH

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions