hcb icon indicating copy to clipboard operation
hcb copied to clipboard

Invoice: Fix state management

Open garyhtou opened this issue 2 years ago • 3 comments

We're currently using AASM, a status enum, and a handful of timestamp columns (e.g. archived_at) to manage the state of an invoice. This is too much!

Here's what we need to do.

  1. Fully build out the AASM states for Invoice so that it can handle all states
  2. Write a migration script that will update aasm_state with the correct state. It will become the one source of truth
  3. Remove the status enum and clean up unused or old scopes and state-related methods

warning: this is a fairly difficult ticket! take it on if you're looking for a challenge

garyhtou avatar Jan 10 '24 05:01 garyhtou

A couple of notes:

  • Let's drop support for draft invoices and delete them from the database. StuTech no longer operates and SacHacks seems to
  • Let's add a archived_v2 state to AASM
  • We also need to handle a deposited_v2 state to AASM

sampoder avatar Jan 10 '24 07:01 sampoder

I'm going to take a crack at this

rluodev avatar Aug 02 '25 06:08 rluodev

happy to report that after doing some research it looks like there are not any draft invoices.

just gonna turn gary's list of things into a task list for my adhd:

  • [x] Fully build out the AASM states for Invoice so that it can handle all states (#11254)
  • [ ] Write a migration script that will update aasm_state with the correct state. It will become the one source of truth (#11847)
  • [ ] Remove the status enum and clean up unused or old scopes and state-related methods

rluodev avatar Aug 02 '25 06:08 rluodev