[16.0][ADD] mis_builder_hierarchy: auto-expand hierarchical source data#736
Open
n3n wants to merge 4 commits into
Open
[16.0][ADD] mis_builder_hierarchy: auto-expand hierarchical source data#736n3n wants to merge 4 commits into
n3n wants to merge 4 commits into
Conversation
Adds a new module that extends mis_builder to render account-detail rows as a tree when the source model exposes a parent_id (e.g. account.analytic.account). Parent rows are created on the fly by walking the parent chain from each leaf account; their values are aggregated bottom-up (sum of own value plus descendants), and the OWL widget, QWeb PDF and XLSX exporters all honor the row depth with indentation and expand/collapse controls.
…m style Address review feedback: - Drop ad-hoc _hierarchy_level dict key on style_props; instead fold the computed depth into style_props.indent_level, which upstream to_css_style / to_xlsx_style already render. Removes the mis.report.style override and the QWeb PDF inherit entirely. - Replace BFS browse loop with a single parent_path read (one or two queries regardless of tree depth). - Cache the children-by-parent map per KPI on the matrix; iter_rows and as_dict reuse it instead of rebuilding. - Drop the compute_sums and _compute_matrix patches; rely on the single compute_comparisons pre-hook (which always runs before compute_sums in upstream) plus the idempotency flag. - Memoize OWL hiddenKeys keyed on body+collapsed identity (O(N) per toggle instead of O(N²)). - Switch auto_expand_accounts_rollup from Selection to Boolean. - Add OCA manifest fields (maintainers, development_status).
…as selector View inheritance fails because Odoo forbids @string in xpath selectors. Target the unique field name auto_expand_accounts_style_id instead.
visible_rows yields KpiMatrixRow objects and result['body'] yields dicts. The variable names assumed (row, row_data) but zip was called in (visible_rows, result['body']) order, so row became the dict and the .kpi attribute access raised AttributeError.
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.
Summary
New module
mis_builder_hierarchythat extendsmis_builderto render account-detail rows as a tree whenever the source model exposes a self-referencingparent_id(e.g.account.analytic.account). Parent rows are auto-created by walking the parent chain from each leaf account that AEP returned, values are aggregated bottom-up (own + sum of descendants), and the OWL widget, QWeb PDF, and XLSX exporters all honor row depth via indentation and an expand/collapse caret. Achieved without forking upstreammis_builder— uses Odoo_inheritfor the model layer and minimal monkey-patches on the plain-PythonKpiMatrix/KpiMatrixRowclasses.Two new opt-in fields on
mis.report.kpi:auto_expand_accounts_hierarchical(toggle) andauto_expand_accounts_rollup(sum / none).Test plan
./odoo-bin -d <db> -i mis_builder_hierarchy --stop-after-initDisplay details by accounton an analytic source, enableExpand as hierarchyand verify parent rows appear with rolled-up values