Skip to content

[FR] Cache part requirements #11211

Description

@SchrodingersGat

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/BOMrelated to BOM/assembly logic and possible engine improvementsenhancementThis is an suggested enhancement or new featurefeature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions