Skip to content

[20.0][ADD] mis_builder_analytic_source - #78

Open
mileo wants to merge 2 commits into
OCA:20.0from
kmee:20.0-add-mis_builder_analytic_source
Open

mileo wants to merge 2 commits into
OCA:20.0from
kmee:20.0-add-mis_builder_analytic_source

Conversation

@mileo

@mileo mileo commented Oct 15, 2026

Copy link
Copy Markdown
Member

Moved from OCA/mis-builder#849 (20.0) as requested by @sbidoul.

Depends on OCA/mis-builder#842 (mis_builder 20.0) and OCA/reporting-engine#1203 (report_xlsx 20.0), referenced in test-requirements.txt.

Summary

Since 16.0 a journal item has an analytic_distribution instead of one analytic account. The analytic filter of a MIS report (analytic_distribution_search in [id]) keeps the full balance of every item whose distribution contains the account, so a P&L per project or contract is overstated as soon as an item is split. Costs that only exist as analytic lines (timesheets) are not seen. See OCA/mis-builder#608.

This module adds mis.analytic.move.line, a SQL view over account.analytic.line with the fields MIS Builder expects from a move lines source. Analytic lines already carry the prorated amount, one line per account, so a report that uses it as Move lines source gives the exact figures.

journal item: expense 1000, analytic_distribution {A: 60, B: 40}

balp[expense], analytic filter A
  move lines source = account.move.line        -> 1000
  move lines source = mis.analytic.move.line   ->  600
mis.analytic.move.line (view on account.analytic.line)
  account_id      general account, or the company fallback account
                  (setting; default: first Cost of Revenue account)
  debit/credit    from the analytic amount, same sign as journal items
  parent_state    state of the journal entry ('posted' for manual lines)
  analytic_distribution   {analytic account: 100}, so the existing
                          analytic_distribution_search domain keeps working
  line_origin     journal / timesheet / manual

No change in mis_builder: it only uses the existing Move lines source option.

Evidence

mis_builder_analytic_source: 4 tests passing on 16.0:

  • the split journal item gives one line per analytic account (600 / 400);
  • same AEP expression and same analytic domain: 1000 on account.move.line, 600 on the new source;
  • a manual analytic line without financial account lands on the fallback account;
  • multi-company record rule.

pre-commit passes. The module has been used since 09/2026 in KMEE customer demos for P&L per contract (16.0 and 18.0).

Merge Danger

Door: two-way

New module, Alpha. Nothing changes for reports that keep account.move.line as source.

Blast Radius: opt-in

Only MIS report templates that select this source. Known limits in ROADMAP: no currency conversion (analytic lines are in company currency) and draft entries have no analytic lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:mis_builder_analytic_source Module mis_builder_analytic_source series:20.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants