Skip to content

chore(company): remove OETH eligibility and annual budget fields#33

Open
AntoinePoindron wants to merge 5 commits intomainfrom
chore/remove-oeth-and-budget-annual
Open

chore(company): remove OETH eligibility and annual budget fields#33
AntoinePoindron wants to merge 5 commits intomainfrom
chore/remove-oeth-and-budget-annual

Conversation

@AntoinePoindron
Copy link
Copy Markdown
Collaborator

Summary

Removes the "Budget et obligation d'emploi" block from /client/settings and every other usage of Company.oeth_eligible and Company.budget_annual in the codebase, since the data isn't relied on by any business logic anymore.

Why

  • The block surfaces two fields that no admin or client_admin actually uses to drive decisions.
  • valorisable_agefiph on quotes is computed in services/quotes.py from total_ht directly — independent of Company.oeth_eligible. So dropping the flag has no impact on AGEFIPH calculation.
  • Less form to fill at signup/settings, smaller schema.

Scope (end-to-end)

  • Migration: new alembic revision b1d4f7e9a3c2 drops both columns from companies.
  • Model (models.py): oeth_eligible and budget_annual columns removed.
  • Form (forms/client.py): SettingsForm.oeth_eligible and SettingsForm.budget_annual fields removed. BooleanField/DecimalField imports kept (still used by other forms).
  • Route (blueprints/client/profile.py): /client/settings POST stops assigning the fields.
  • Templates removed/updated:
    • templates/client/settings.html — the entire "Block 3: Budget et obligation d'emploi" section
    • templates/admin/companies/detail.html — OETH header badge + Budget annuel info row
    • templates/admin/companies/list.html — OETH column (header + cells)
    • templates/admin/qualification/detail.html — OETH badge
  • Seed (seed_data.py): Acme/TechCorp fixtures stop passing the kwargs.

Test plan

  • All 195 existing tests pass
  • Migration applies cleanly locally (Running upgrade e5b1c2a4d8f9 -> b1d4f7e9a3c2)
  • After merge: smoke-test on staging — /client/settings no longer shows the block, save still works, admin views render without OETH column
  • Confirm AGEFIPH valorization on quotes is unchanged (it's based on caterer type, not company OETH)

Migration safety

The migration is a pure column drop. No data dependency. Reversible via downgrade() (re-creates both columns with sensible defaults), although prod data will be lost on revert — same as any column drop.

🤖 Generated with Claude Code

@Scttpr
Copy link
Copy Markdown
Member

Scttpr commented May 8, 2026

Tu retires la valorisation AGEFIPH de l'UI mais pas de la DB c'est voulu ?

@AntoinePoindron
Copy link
Copy Markdown
Collaborator Author

Oups non c'était un oubli, la PR est à jour

Antoine Poindron and others added 5 commits May 9, 2026 09:39
The "Budget et obligation d'emploi" block on /client/settings is no
longer used and the underlying data isn't relied on for any business
logic — valorisable_agefiph on quotes is computed from total_ht
regardless of company OETH status (services/quotes.py).

Removes the two columns (oeth_eligible, budget_annual) end-to-end:
- DB:        new alembic migration drops both columns from companies
- Model:    Company columns removed
- Form:     SettingsForm fields removed (BooleanField/DecimalField
            still used elsewhere — no import cleanup needed)
- Route:    /client/settings POST handler stops assigning them
- Templates: client settings block + admin views (company list/detail,
            qualification detail) no longer reference the fields
- Seed:     Acme/TechCorp fixtures stop setting them

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Same theme as the OETH/budget removal in this PR — none of these
displays drives a business action, they were AGEFIPH valorisation
read-outs from a feature we no longer surface. Drop them from the
templates without touching `Quote.valorisable_agefiph` (still
computed in services/quotes.py and persisted on the row, in case a
future view wants it back).

Hits all four places it appeared:
- templates/client/requests/detail.html  → quote card "Devis reçus"
- templates/client/orders/detail.html    → "Devis accepté" panel
- templates/caterer/orders/detail.html   → "Montants" panel
- templates/admin/orders/detail.html     → "Montants" panel

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Dev review on the AGEFIPH UI removal: the column was hidden in the
templates but still computed, persisted, and shipped on every Quote
and Invoice row. Drop it from the schema too so the DB matches what
the user-facing surfaces actually use.

- new alembic migration c9e8d7a4f1b2 drops the column from `quotes`
  and `invoices` (down_revision: b1d4f7e9a3c2)
- models.py: remove the Mapped[Decimal | None] columns on Quote
  and Invoice
- services/quotes.py: drop the `valorisable_agefiph = total_ht`
  computation and the matching key in the returned totals dict
- services/stripe_service.py: stop passing valorisable_agefiph to
  Invoice() at billing time
- blueprints/caterer/requests.py: stop assigning the field on
  Quote create / update
- seed_data.py + scripts/demo_caterer_statuses.py: drop the
  fixture kwargs
- tests/test_quote_calculations.py: drop the now-irrelevant
  `test_valorisable_agefiph_equals_total_ht` and the agefiph
  assertion in `test_empty_lines_returns_zeros`, plus the key in
  the Decimal-type guard

Total HT is still computed for AGEFIPH-style external reporting
should we ever need it again — calculate_quote_totals returns it
under "total_ht".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Post-rebase fixups for the AGEFIPH DB removal series:
- app.py: ruff format --check failed on the post-rebase file
  (a recent merge into main left it slightly off-spec).
- tests/test_notifications.py: the new test
  test_visiting_request_detail_also_clears_child_quote_notifs
  (added by #36) was constructing a Quote with
  valorisable_agefiph=Decimal("100.00"). With the column dropped
  in this PR's earlier commit, that kwarg is now invalid and
  raises TypeError. Drop the kwarg.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AntoinePoindron AntoinePoindron force-pushed the chore/remove-oeth-and-budget-annual branch from d7b28d9 to 574901b Compare May 9, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants