Skip to content

[16.0][ADD] mis_builder_analytic_source - #845

Closed
mileo wants to merge 1 commit into
OCA:16.0from
kmee:16.0-add-mis_builder_analytic_source
Closed

mileo wants to merge 1 commit into
OCA:16.0from
kmee:16.0-add-mis_builder_analytic_source

Conversation

@mileo

@mileo mileo commented Oct 13, 2026

Copy link
Copy Markdown
Member

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 #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); the 18.0 version will follow as a forward port.

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.

@sbidoul

sbidoul commented Oct 13, 2026

Copy link
Copy Markdown
Member

Hi @mileo, can you move this PR to the oca/mis-builder-contrib repo?

@mileo

mileo commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

Moved to OCA/mis-builder-contrib#74, as requested. Thanks @sbidoul.

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:16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants