1

I am creating a web tool to manage bills of materials (BOM). I managed to get some nice presentation of BOMs using django with js-tree but now I would like to put all of this in a database. My trees look like this:

- Root Part (ie Product A)
  - PartA - Qty: 1
    - PartB - Qty: 1
  - PartC - Qty: 1
    - Part D - Qty: 4
    - Part E - Qty: 1
      - Part F - Qty: 2
...

The problem is that a same part can be present in different products, or in different subassembly (think of a screw for example).

I would like to be able to reuse an existing node (and its children) in an other tree (for example I could have a Product B that also include Part E (and thus Part F)). If I am updating a node (ie Part E) the change should appear in every trees where it is used.

django-mptt seems a good candidate but unfortunately a node can only have one parent. There is a TreeManyToManyField but nothing in the documentation about it, I am not sure if it could help me.

I could create the Part as a regular model and have a second model Bom Structure to create the trees, each instance being link to a Part but I can't see how it will keep the children of a part.

How does people manage this issue usually?

Romn
  • 174
  • 2
  • 14

1 Answers1

-2

There is a newer solution for BOM: BOM is a simple Django app to manage a bill of materials. It supports multiple part numbering schemes, tracking component sourcing information, estimates costs, and contains smart integrations with Mouser to pull in the latest component pricing and Google Drive for part file management. BOM is written in Python 3 and Django 3. https://pypi.org/project/django-bom/

Jorge
  • 57
  • 7
  • A link to a solution is welcome, but please ensure your answer is useful without it: [add context around the link](//meta.stackexchange.com/a/8259) so your fellow users will have some idea what it is and why it’s there, then quote the most relevant part of the page you're linking to in case the target page is unavailable. [Answers that are little more than a link may be deleted.](//stackoverflow.com/help/deleted-answers) – double-beep May 29 '20 at 18:22