No description
  • JavaScript 89.6%
  • Python 10.4%
Find a file
Henry Hoegelo db9ed993cb Fix org chart clipping and text overlap
Boxes are drawn centred on their slot, so the outermost ones stuck out by
half a box and got cut off at the left edge. The viewBox origin now makes
room for that, and the width accounts for the box instead of the step.

The part name also ran into the "+n parts" note; it is clipped shorter now
when that note is present. Boxes widened 156 -> 174 px.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-20 19:33:09 +02:00
inventree_bom_viewer Fix org chart clipping and text overlap 2026-08-20 19:33:09 +02:00
.gitignore Add BOM tree panel plugin for InvenTree 2026-08-20 18:09:09 +02:00
MANIFEST.in Rename plugin to inventree-bom-viewer 2026-08-20 18:39:02 +02:00
pyproject.toml Rename plugin to inventree-bom-viewer 2026-08-20 18:39:02 +02:00
README.md Add org chart and mind map views, fix toggle accessibility 2026-08-20 19:25:57 +02:00

inventree-bom-viewer

Adds a BOM Tree panel to the detail page of every assembly in InvenTree: the multi-level bill of materials in one view, instead of clicking through one table per level. Quantities are cumulative -- multiplied down through the levels.

Three views, switched in the panel:

  • List -- a collapsible outline. Every row links to the part and carries flags for consumable, optional, an empty sub-BOM, a depth cut-off or a cycle.
  • Org chart -- boxes top-down, one colour per top-level branch.
  • Mind map -- the same tree branching left to right along curves.

Both charts have a zoom slider and a Sub-assemblies only switch. That switch matters: a BOM with many single parts per level becomes several thousand pixels wide as a chart, because every screw claims its own column. Folding the plain parts away keeps the structure readable; the boxes then show +n parts for what was folded. It defaults to on for the org chart and off for the mind map.

Requirements

  • InvenTree >= 1.0 (developed against 1.4.0, API 511)
  • Global setting Enable interface integration (ENABLE_PLUGINS_INTERFACE) switched on, otherwise no plugin panel is shown anywhere.

The plugin needs no other integration setting: it reads /api/bom/ through the session the user is already logged in with. There is no custom endpoint.

Install

Admin Center -> Plugins -> Install Plugin, from this git URL. Then activate the plugin and reload the page.

Development notes

The frontend is a hand-written ES module (inventree_bom_viewer/static/BomViewer.js) using the React and MantineCore globals that InvenTree exposes to plugins. That avoids a npm/Vite toolchain for what is a single panel. If the panel ever grows beyond this, switch to the official plugin-creator layout.

The entry point must accept exactly one argument -- InvenTree dispatches on Function.length, and 0 or 3+ arguments are rejected. Note that default parameters do not count towards length.