# Topic: gl_lines — the RAW general-ledger dataset (posted journal lines). Company-level (no BU # filter — GL isn't team-scoped). BASIS RULE (the glaccount-vs-account lesson, now model law): # this is the RAW-GL basis; NEVER mix it with the management-basis P&L in one analysis. key: gl_lines label: General ledger (raw, posted) entity: account.move.line # store-only topic: no live-path domain builder yet (lands with the Expenses retrofit); # store_query() is authoritative; the parity check below compares against a DIRECT live aggregate scope: posted_only: "journal entries with state = posted only" basis: "RAW GL — debit-positive balance; expenses positive, income negative (negated in metrics)" level: "company-level (HQ) — no business-unit split" date_field: "accounting date (account.move.line.date)" grain: "one row per posted journal line; time-filterable by accounting date" store: table: account_move_line alias: l join: "JOIN account_move m ON m.id = l.move_id JOIN account_account a ON a.id = l.account_id" date_col: "l.date" scope_sql: "m.state = 'posted'" dims: account: {col: "l.account_id", name_col: "l.account_name", label: "GL account"} account_type: {col: "a.account_type", name_col: null, label: "Account type"} partner: {col: "l.partner_id", name_col: "l.partner_name", label: "Partner"} ai_context: > The raw posted general ledger. Use for operating-expense analysis (opex), GL-basis revenue, and ledger drill-downs — the same basis as the Expenses dashboard. Expense-type accounts ('expense', 'expense_depreciation') carry opex; 'expense_direct_cost' is COGS and is EXCLUDED from opex by definition. Income accounts store credit-negative balances; the gl_revenue metric negates them to read positively. This topic is company-level: business-unit filters do not apply here (use sales_lines for BU questions). The newest month is often still being booked — a sharply lower final month usually means an OPEN period, not a cost win (close-lag).