Add Tradon accounting report notes

This commit is contained in:
2026-05-05 19:45:54 +02:00
parent 72a2c2d04f
commit fe47f81466

View File

@@ -0,0 +1,292 @@
# General Ledger Gap Analysis
Date: 2026-05-05
Comparison scope:
- Ideal target: `C:/DataS/OpenSquared/Tradon/Source/Accounting_report/accounting_report/Reports/GL/GL_001_general_ledger.md`
- Standards: `Docs/reporting_standards.md`, `Docs/reporting_parameters.md`,
`Docs/reporting_fields_catalog.md`
- Current Tryton/Tradon source:
- `modules/account/account.py`
- `modules/account/account.xml`
- `modules/account/view/general_ledger_account_list.xml`
- `modules/account/view/general_ledger_line_list.xml`
- `notes/accounting/reporting.md`
## 1. Executive Summary
Tryton already has a strong General Ledger foundation:
- account-level opening, movement and closing balances;
- date or period filtering;
- journal filtering;
- posted-only option;
- drill-down from accounts to detailed move lines;
- running balance at line level;
- party drill-down for party-required accounts.
The main gap is that the ideal `GL-001` is specified as a complete detail
report, grouped by account and transaction currency, with explicit opening and
closing rows and a rich audit column set. Tryton's current standard General
Ledger is split between:
- an account summary view/report (`account.general_ledger.account`);
- a line drill-down view (`account.general_ledger.line`).
It does not expose the ideal output as one flat, export-ready report.
## 2. Parameters
### Covered by Tryton
Ideal parameter | Tryton current support
--- | ---
`date_from` | supported as `from_date`
`date_to` | supported as `to_date`
`journal` | supported in `account.general_ledger.account.context`
`entity` | supported through current `company` context
### Partial or missing
Ideal parameter | Gap
--- | ---
`account` | Tryton opens all non-closed typed accounts in the GL account view; account selection is possible via UI/domain/drill-down, but not a first-class explicit report parameter in the context model.
`currency` | missing as an explicit GL parameter. Tryton exposes company currency and line `second_currency`, but the GL context has no transaction-currency filter.
`entity` | supported as current company, but no explicit multi-entity selector. This may be acceptable because the ideal spec says current entity unless ERP supports more.
`document number or voucher number` | not a first-class filter in the General Ledger context.
Out-of-scope ideal parameters (`counterparty`, `analytic_account`,
`profit_center`) are also not part of the current Tryton GL context. That aligns
with the ideal scope, except party drill-down exists as an extra Tryton feature.
## 3. Filtering Gaps
Ideal filter | Tryton status
--- | ---
Posting date between `date_from` and `date_to` | covered via `from_date` / `to_date`, though Tryton also supports period range.
Account or account range | partial. Account range is not visible as a standard context parameter.
Currency | gap. No explicit transaction-currency filter.
Journal | covered.
Entity | covered by company context, not explicit user-facing parameter.
Document/voucher number | gap in context; can likely be searched on line/move fields, but not a report parameter.
Posted/non-posted scope | Tryton supports `posted` boolean; ideal treats `posting_status` as output information, not default filter.
## 4. Sorting Gaps
Ideal default sorting:
1. account
2. transaction currency
3. posting date
4. document number
Tryton current behavior:
- `account.general_ledger.account` sorts by account.
- `account.general_ledger.line` sorts by date ascending.
- running balance window orders by `move.date`, then line id.
Gaps:
- no primary transaction-currency sort;
- no document-number sort in default GL line ordering;
- account grouping happens one level above the line view, not as a single flat
ordered export;
- document number is not clearly mapped to `move.number` vs `move.post_number`.
## 5. Grouping and Balance Presentation
Ideal:
- group by account and transaction currency;
- display opening balance row per account/currency;
- display detailed movement lines;
- display closing balance row per account/currency;
- show balances in both transaction currency and base currency;
- calculate running balances line by line.
Tryton:
- account summary has `start_balance`, `debit`, `credit`, `end_balance`;
- line view has `debit`, `credit`, `amount_second_currency`, `balance`;
- line running balance exists in base currency via `internal_balance` plus
start balance;
- no explicit opening/closing rows in the line report;
- no grouped transaction-currency balance presentation;
- second currency amount is a single signed amount, not split debit/credit and
running balance.
Gaps:
- missing account/currency opening and closing rows;
- missing transaction-currency running balance;
- missing debit/credit split in transaction currency;
- missing transaction-currency totals;
- current printable General Ledger is account-driven, not the full ideal
detailed layout.
## 6. Output Column Gaps
### Covered or mostly mappable
Ideal column | Tryton source candidate
--- | ---
`entity` | `company`
`account` | `account.account.code` via ledger account
`account_name` | `account.account.name`
`base_currency` | company currency
`posting_date` | `account.move.date` / line date
`journal` | `account.move.journal`
`journal_entry_number` | likely `account.move.number` or `post_number`
`document_number` | likely `account.move.number` or invoice number depending definition
`posting_status` | `account.move.state`
`counterparty` | `account.move.line.party`
`description` | line `description_used` / move description
`reference` | move `origin`, `ext_ref`, invoice reference depending mapping
`debit_base_currency` | line `debit`
`credit_base_currency` | line `credit`
`balance_base_currency` | line `balance`
`entered_date` | line/move `create_date`
`modified_date` | line/move `write_date`
### Gaps or mapping questions
Ideal column | Gap
--- | ---
`transaction_currency` | Tryton has `second_currency`, but base-currency lines may have no transaction currency. Need convention: use `second_currency` else company currency?
`document_date` | not exposed in current GL line view. Could map to invoice date for invoice origins, move date otherwise.
`document_type` | not exposed. Needs mapping from origin model or journal/type.
`supplier_invoice_number` | not exposed. Could map to supplier invoice `reference` for AP invoice origins, but requires origin-specific logic.
`voucher_number` | not exposed; need decide whether `move.number`, `post_number`, `ext_ref` or another internal ref is voucher.
`payable_qty` | not in standard GL. Tradon may map from lot/invoice/fee/trade links on move lines, but requires custom logic.
`uom` | same as payable quantity.
`debit_transaction_currency` | missing as explicit split; Tryton stores signed `amount_second_currency`.
`credit_transaction_currency` | missing as explicit split.
`balance_transaction_currency` | missing as running balance.
`entered_by` | not exposed in GL view; can be mapped from `create_uid`.
`modified_by` | not exposed in GL view; can be mapped from `write_uid`.
## 7. Sign Convention Gaps
Ideal GL convention:
- debit amounts positive;
- credit amounts negative;
- running balances use debit-positive and credit-negative convention.
Tryton:
- base debit and credit are stored/displayed as positive numeric columns;
- balance uses `debit - credit`;
- second currency is signed in `amount_second_currency`.
Gaps:
- ideal asks `credit_transaction_currency` and `credit_base_currency` as
negative amounts, but Tryton displays credit column as positive amount;
- need decide whether exports should preserve Tryton UI convention or transform
credits to negative for the ideal GL layout.
## 8. Audit Trail Gaps
Ideal requires enough audit references to trace:
- accounting document;
- source document;
- AP supplier invoice number when available;
- creation/modification user and dates.
Tryton has the raw ingredients:
- move;
- line origin;
- move origin;
- invoice origin in many generated flows;
- `create_uid`, `create_date`, `write_uid`, `write_date`.
But current GL output does not expose:
- source document number/date/type in normalized columns;
- supplier invoice number;
- entered/modified user labels;
- voucher/reference mapping;
- payable quantity/uom for commodity postings.
## 9. Export Gaps
Ideal:
- CSV;
- XLSX;
- PDF including all detail columns.
Tryton:
- standard UI list export may cover CSV-like exports depending client;
- printable report is `.fodt` -> usually PDF/ODT;
- the standard PDF is not designed to include all ideal detail columns;
- no dedicated XLSX export is identified for General Ledger.
Gaps:
- dedicated XLSX export;
- wide detailed PDF;
- one export-ready flat GL dataset.
## 10. Controls and Reconciliation
Ideal controls:
- debit/credit reconcile by selected period, account and transaction currency;
- opening + movements = closing by account/currency;
- base total reconciles with trial balance;
- line audit references preserved.
Tryton:
- move posting enforces balanced moves in company currency;
- GL account start/debit/credit/end balances support reconciliation in base
currency;
- Trial Balance reuses the same account model, which helps base-currency
reconciliation.
Gaps:
- transaction-currency reconciliation by account/currency is not explicit;
- opening/movement/closing by transaction currency not implemented in current
GL model;
- audit reference completeness depends on origin mapping not present in GL
report.
## 11. Prioritized Gaps
Priority | Gap
--- | ---
High | Build or expose a flat detailed GL dataset matching `GL-001`, not only account summary + drill-down.
High | Add transaction currency grouping/filtering and running balances.
High | Add opening and closing rows by account and transaction currency.
High | Define mapping for `document_number`, `journal_entry_number`, `voucher_number`, `reference`.
High | Normalize source document metadata: document type, document date, supplier invoice number.
Medium | Split `amount_second_currency` into debit/credit transaction-currency columns.
Medium | Decide and implement GL sign convention transformation for credit columns.
Medium | Add audit columns `entered_by`, `entered_date`, `modified_by`, `modified_date`.
Medium | Add dedicated CSV/XLSX export target.
Low/Trade-specific | Add `payable_qty` and `uom` for commodity-related postings, probably using Tradon lot/invoice/fee links.
## 12. Open Questions
- In Tryton mapping, should `document_number` be `account.move.number`,
`account.move.post_number`, invoice `number`, or a context-dependent value?
- Should `journal_entry_number` be `move.number` and `document_number` be the
business document number?
- Is `voucher_number` distinct in Tradon, or should it remain blank?
- Should `transaction_currency` default to company currency when
`second_currency` is empty?
- Should credit columns be exported as negative values to match the ideal GL,
even though Tryton UI displays credit as positive?
- Which origin models should feed `document_date` and `document_type` in the
first implementation?
- Can payable quantity/uom be derived reliably from `account.move.line.lot`,
`fee`, or invoice line origin for all commodity postings?