From 9c9777db57ded6a1affcede339c08992db9a4c67 Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Wed, 13 May 2026 11:55:47 -0400 Subject: [PATCH] [18.0][ADD] mis_builder: add multi-company demo data Adds demo data that creates a second company with expense accounts, journal entries, and a multi-company MIS report instance. Useful for exercising multi-company report rendering in tests and demos. Only loaded when demo data is enabled. Includes a `_post_demo_moves()` helper on `mis.report.instance` that posts the seeded draft journal entries so the demo report renders non-zero values. --- mis_builder/__manifest__.py | 3 + mis_builder/demo/mis_multicompany_demo.xml | 147 +++++++++++++++++++++ mis_builder/models/mis_report_instance.py | 15 +++ 3 files changed, 165 insertions(+) create mode 100644 mis_builder/demo/mis_multicompany_demo.xml diff --git a/mis_builder/__manifest__.py b/mis_builder/__manifest__.py index 1ea8ca89f..8694d6351 100644 --- a/mis_builder/__manifest__.py +++ b/mis_builder/__manifest__.py @@ -28,6 +28,9 @@ "report/mis_report_instance_qweb.xml", "report/mis_report_instance_xlsx.xml", ], + "demo": [ + "demo/mis_multicompany_demo.xml", + ], "assets": { "web.assets_backend": [ "mis_builder/static/src/components/mis_report_widget.esm.js", diff --git a/mis_builder/demo/mis_multicompany_demo.xml b/mis_builder/demo/mis_multicompany_demo.xml new file mode 100644 index 000000000..641df4ef6 --- /dev/null +++ b/mis_builder/demo/mis_multicompany_demo.xml @@ -0,0 +1,147 @@ + + + + + + Branch Office + + + + + + + + + + 600000 + Expenses + expense + + + + + + 611000 + Purchase of Equipments + expense + + + + + + 101401 + Bank + asset_current + + + + + + Miscellaneous + general + MISC + + + + + + + + 2026-03-10 + + + + + + + + 2026-02-20 + + + + + + Multi-Company Expenses + + + + + exp + Expenses + True + 10 + + + + + balp[600%] + + + + + equip + Equipment + True + 20 + + + + + balp[611%] + + + + + total + Total + 100 + AccountingTotal + + + + + exp + equip + + + + + Multi-Company Expenses Report + + True + True + + + + + + + Year to Date + relative + actuals + y + 0 + 1 + 10 + + + + + diff --git a/mis_builder/models/mis_report_instance.py b/mis_builder/models/mis_report_instance.py index 9acf6fe63..fdbbc027a 100644 --- a/mis_builder/models/mis_report_instance.py +++ b/mis_builder/models/mis_report_instance.py @@ -1029,3 +1029,18 @@ def _compute_user_can_edit_annotation(self): self.user_can_edit_annotation = self.env.user.has_group( "mis_builder.group_edit_annotation" ) + + @api.model + def _post_demo_moves(self): + """Post demo journal entries for the multi-company demo report.""" + xmlids = [ + "mis_builder.move_branch_consulting", + "mis_builder.move_branch_furniture", + ] + for xmlid in xmlids: + move = self.env.ref(xmlid, raise_if_not_found=False) + if move and move.state == "draft": + try: + move.action_post() + except Exception: + _logger.debug("Could not post demo move %s", xmlid)