Skip to content

[18.0] mis_builder: add checks for P&L and balance sheet#785

Open
alexis-via wants to merge 3 commits into
OCA:18.0from
akretion:18.0-pl-consistency-check-final
Open

[18.0] mis_builder: add checks for P&L and balance sheet#785
alexis-via wants to merge 3 commits into
OCA:18.0from
akretion:18.0-pl-consistency-check-final

Conversation

@alexis-via
Copy link
Copy Markdown
Contributor

This PR adds an optional selection field on mis.report with 2 possible values:

  1. P&L
  2. Balance Sheet

If this optional selection field is set to P&L, it will check that only balp is used and that each income & expense account is used exactly once and that no other account is used
If the optional selection field is set to Balance sheet, it will check that only bale/pbale/nbale are used, that each account (unless off_balance and equity_unaffected) is used once for bale, or once in pbale AND once is nbale.

Questions on this PR:

Where should we plug the constraint checks on mis.report.instance ?
At the moment, it is called when you click on the buttons "Preview" or "Print" or "Export". But it is not called when the report is in the dashboard. Which method should we inherit to perform checks in all circumstances ?

In v18, the display_name of an account depends on the company of the context. I use the display_name of accounts in error messages, but a MIS report template can apply to several companies. At the moment, I use the display_name of the first company of the MIS report template.

We could adds checks for the signs in the formula (cf TODO in comments).

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @sbidoul,
some modules you are maintaining are being modified, check this out!

@alexis-via
Copy link
Copy Markdown
Contributor Author

In some countries (BE for example), there are some informative lines ("Of which ...") in P&L or balance sheet that need to be excluded from the constraint. We should add a boolean field such as "constraint_exclude" on mis.report.kpi that would be enabled for the lines "Of which ..." in order to exclude them from the constraint.

Example:
https://github.com/OCA/l10n-belgium/blob/18.0/l10n_be_mis_reports/data/mis_report_pl_m01-f.xml#L231

sbidoul and others added 3 commits May 27, 2026 16:32
New field constraint_type on mis.report.
If field 'constraint_type' is set, Odoo will check the MIS report template before
displaying the report to the user.
This new boolean option on KPI to ignore constraint is useful when you
have a KPI in the P&L or balance sheet such as "Of which ..."
@alexis-via alexis-via force-pushed the 18.0-pl-consistency-check-final branch from 99e977c to cf8863d Compare May 27, 2026 14:33
@alexis-via
Copy link
Copy Markdown
Contributor Author

@sbidoul as discussed, I added the boolean option "ignore_constraint" on KPIs.

@sbidoul
Copy link
Copy Markdown
Member

sbidoul commented May 28, 2026

@alexis-via Would it make sense to accept and ignore balu and the special account for unallocated result for Balance Sheet constraints?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants