[18.0] mis_builder: add checks for P&L and balance sheet#785
Open
alexis-via wants to merge 2 commits intoOCA:18.0from
Open
[18.0] mis_builder: add checks for P&L and balance sheet#785alexis-via wants to merge 2 commits intoOCA:18.0from
alexis-via wants to merge 2 commits intoOCA:18.0from
Conversation
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.
Contributor
|
Hi @sbidoul, |
This was referenced Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an optional selection field on mis.report with 2 possible values:
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).