feat(accounting): split Incoming invoices vs Expenses - flags, schema, settings (stage 1)
Foundation for separating external supplier invoices from internal expenses, per design review. This stage is additive + buildable; the service/route/UI data rework follows in stage 2. - Migration 126: incoming invoices own their payable on inbound_documents (supplier_paid/at/method/ref + disposition + tax_treatment + booking event_id + category_id + re-bill markup/linkage); expenses gain kind (amount/mileage/ per_diem) + quantity + snapshotted rate_minor. Additive, hasColumn-guarded. - Migration 127: seed `expenses` feature flag (default off) + accounting app_settings (accounting_km_rate_minor=70, accounting_per_diem_rate_minor=0, accounting_require_proof=false). - Backend: `expenses` added to feature-flag known/defaults/dependency (forced off when the accounting master is off); new PUT /admin/settings/accounting (read via the generic GET /:type). - Frontend: `expenses` flag (type + context + dependency); Features tab gets an Expenses sub-card; the Expenses sub-nav + route now gate on `expenses` (not incomingInvoices); AccountingIndex prefers inbox -> expenses -> tax. - i18n: settings.features.expenses.* (EN + DE). Verified: node -c; migration 124->126->127 harness (new columns, flag, settings + idempotency); en/de JSON valid; npm run build green.
This commit is contained in:
@@ -48,9 +48,12 @@ export const DEFAULT_FLAGS: FeatureFlags = {
|
||||
// Accounting (migration 122). Top-level MASTER for the Accounting
|
||||
// section (separate from CRM). Sub-features below require it.
|
||||
accounting: false,
|
||||
// Incoming invoices (migration 124) — supplier-invoice capture +
|
||||
// expenses + re-bill. Accounting sub-feature; requires `accounting`.
|
||||
// Incoming invoices (migration 124) — external supplier-invoice capture +
|
||||
// re-bill. Accounting sub-feature; requires `accounting`.
|
||||
incomingInvoices: false,
|
||||
// Expenses (migration 127) — internal expenses (mileage / per-diem / cash).
|
||||
// Separate Accounting sub-feature; requires `accounting`.
|
||||
expenses: false,
|
||||
};
|
||||
|
||||
export const FEATURE_FLAGS_QUERY_KEY = ['feature-flags'] as const;
|
||||
@@ -87,6 +90,7 @@ function applyDependencyRules(flags: FeatureFlags): FeatureFlags {
|
||||
if (out.accounting === false) {
|
||||
out.taxReport = false;
|
||||
out.incomingInvoices = false;
|
||||
out.expenses = false;
|
||||
}
|
||||
// Clients parent flag is DERIVED from its children. Admins don't
|
||||
// toggle it directly — enabling any CRM-area sub-feature
|
||||
|
||||
Reference in New Issue
Block a user