Problem statement
Part "requirement" data is expensive to compute dynamically - and is only becoming more so.
Functionally this data does not change frequently but it used in many "on the fly" database annotations.
Requirement data includes:
- Number required for sales order
- Number required for build orders
- Number allocated to sales orders
- Number allocated to build orders
- Number incoming from purchase orders
These quantities should include:
- Variant quantities (for template parts)
- Substitute options (for BOM lines)
Suggested solution
- Add a new table with a 1:1 relationship to the "part" model which stores this requirements information for rapid access.
- Significantly simplify API calls which currently compute this on the fly
- De-couple business logic from database annotations in the queryset
- Simplify implementation of new features which adjust the requirements for a part
Such a feature would also require that we add a number of hooks to re-calculate the requirements data when the underlying instances change. However we can at least point to a single function which provides a single "source of truth" for each part.
Problem statement
Part "requirement" data is expensive to compute dynamically - and is only becoming more so.
Functionally this data does not change frequently but it used in many "on the fly" database annotations.
Requirement data includes:
These quantities should include:
Suggested solution
Such a feature would also require that we add a number of hooks to re-calculate the requirements data when the underlying instances change. However we can at least point to a single function which provides a single "source of truth" for each part.