hitaji-erp-api/src/accounting/entities/. Column names are the actual database
column names (TypeORM name: where it differs from the camelCase property).
Read this first — the three scoping columnsSeemulti-tenancy.mdfor how these are enforced.
Base classes
Most entities extend one of two base classes (src/common/entities/):
A number of child-line entities define their own
id (and sometimes a
nullable tenant_id) instead of extending BaseEntity — they are reached only
through their parent and cascade-delete with it. These are called out in the
tables below.
Domain 1 — Chart of Accounts & General Ledger
Core ledger cluster (ER diagram)
JournalEntry/JournalLinevsAccountingLedgerEntry— A journal entry is the editable/approvable document. Onpost()the posting pipeline writes the immutableaccounting_ledger_entriesrows (the actual GL). Reports and balances read fromaccounting_ledger_entries; thejournal_linescarry the sub-ledger (against_invoice_id/against_bill_id) and bank-rec clearance tags.
Domain 2 — Sales (Invoices, Quotations, Credit Notes)
Credit notes areInvoicerows withdocumentType = CREDIT_NOTE; debit notes areBillrows withdocumentType = DEBIT_NOTE. Their allocations live inpayment_allocations(see Money).
Domain 3 — Purchases (Bills, Expenses, Petty Cash)
Domain 4 — Money (Payments, Allocations, Loans, Bank Reconciliation, Debts)
Domain 5 — Masters (Contacts, Categories, Tax, Withholding, Payment Terms)
Domain 6 — Budgeting & Cost Centers
Domain 7 — Posting Internals (Outbox, Source-Link, Idempotency, Profiles, Audit)
These are the plumbing that lets other products post into accounting idempotently and durably. They scope bytenant_id (+ business_id/book_id), not
workspace_id.
Domain 8 — Sequences & lifecycle records
JournalSourceType — the product provenance enum
AccountingLedgerEntry.source_type / JournalEntry.source_type tags every GL row
with the upstream module that produced it. The full enum (enums/journal-source-type.enum.ts)
includes the native accounting sources (INVOICE, BILL, PAYMENT, RECEIPT,
MANUAL, OPENING_BALANCE, ADJUSTMENT, CREDIT_NOTE, PETTY_CASH, BANK_LOAN)
plus cross-product sources that bridge into accounting: payroll/HR
(PAYROLL, SALARY_ADVANCE, EMPLOYEE_LOAN, SEPARATION_SETTLEMENT,
GRATUITY_PROVISION, STATUTORY_REMITTANCE, REIMBURSEMENT, IMPREST),
fixed-assets (ASSET_*, DEPRECIATION), retail (RETAIL_*), agriculture
(AGRI360_*), SACCO (SACCO_*), and faith (FAITH360_GIVING).
Gaps / notes for reviewers
- The child-line entity field lists (Domains 2–8) and the
business_idannotations were extracted by reading each entity file; spot-verifiedInvoice,JournalLine,Account,AccountingBook,AccountingPeriod,JournalEntrydirectly. If you change a column, regenerate the relevant table. Invoice,Bill,QuotationextendSubmittableEntity(docstatus lifecycle);ExpenseandBudgetcarry adocstatuscolumn but extendBaseEntity.- Several entities referenced here have additional reporting/scheduling siblings
not tabulated (e.g.
AccountingReportPreset,AccountingReportSchedule,AccountingReportSnapshot,ChartImportBatch,AccountingChartSetup,PrintSettings,ReminderSettings,RecurringTransactionHistory). Seedocs/accounting-reports.mdfor the reporting cluster.