Factorizer/Cluster ERP WikiCluster ERP Türkçe
Home / Business modules

Reference

Critical materials and substitution

Reference for critical_materials and substitution_groups in procurement, with fields, routes, rules, and how MRP and purchase requests use them.

This page describes two sub-modules of src/cluster_erp/modules/procurement/. critical_materials/ marks materials that must not run short, with lead-time bounds and an alert threshold. substitution_groups/ groups product breakdowns that can stand in for each other, with a preference order and a conversion factor. Both are read by the MRP run, described on material requirements planning.

Scope and source

  • Defined in: models.py, services.py, routes.py, and metadata.py of both sub-modules (plus member_metadata.py for substitution members); query handlers in src/cluster_erp/modules/procurement/module.py:578-652.
  • Count: 3 tables; 6 critical material routes and 10 substitution group routes (@router. decorators); no ActionMeta entries.

Critical material fields

Name Meaning Source
product_id, product_model_id, product_version_id Product breakdown src/cluster_erp/modules/procurement/critical_materials/models.py:24-40
lead_time_days_min, lead_time_days_max Lead-time bounds src/cluster_erp/modules/procurement/critical_materials/models.py:41-48
default_vendor_id Default vendor src/cluster_erp/modules/procurement/critical_materials/models.py:49
mrp_alert_threshold_days Days before the planned order date at which MRP raises an alert src/cluster_erp/modules/procurement/critical_materials/models.py:53
is_active, notes Active flag and notes src/cluster_erp/modules/procurement/critical_materials/models.py:59-65

Substitution fields

Entity Fields Source
MaterialSubstitutionGroup (procurement_substitution_groups) code (yearly sequence substitution_group), name, description, is_active src/cluster_erp/modules/procurement/substitution_groups/models.py:24-48, src/cluster_erp/modules/procurement/substitution_groups/services.py:127
MaterialSubstitutionMember (procurement_substitution_members) group_id, product breakdown, preference_order (default 1), conversion_factor (Numeric(10, 6), default 1), is_primary, valid_from, valid_to, notes src/cluster_erp/modules/procurement/substitution_groups/models.py:56-124

Routes

Method and path Permission Source
GET, POST /critical-materials/; GET, PUT, DELETE /critical-materials/{cm_id}; POST /critical-materials/bulk-delete critical_material.read, .create, .update, .delete, .bulk_delete src/cluster_erp/modules/procurement/critical_materials/routes.py:27-106
GET, POST /substitution-groups/; GET, PUT, DELETE /substitution-groups/{group_id}; POST /substitution-groups/bulk-delete substitution_group.read, .create, .update, .delete, .bulk_delete src/cluster_erp/modules/procurement/substitution_groups/routes.py:30-119
GET /substitution-groups/by-product/{product_id} substitution_group.read src/cluster_erp/modules/procurement/substitution_groups/routes.py:68
POST /substitution-groups/{group_id}/members; PUT, DELETE /substitution-groups/{group_id}/members/{member_id} substitution_group.create, .update, .delete src/cluster_erp/modules/procurement/substitution_groups/routes.py:131-165

Constraints and validation

  • A product can be a critical material only once among live rows. The check and the partial unique index use product_id alone, not the breakdown (src/cluster_erp/modules/procurement/critical_materials/models.py:14-21, src/cluster_erp/modules/procurement/critical_materials/services.py:80-91).
  • Critical material and member breakdowns are checked with ensure_product_breakdown (src/cluster_erp/modules/procurement/critical_materials/services.py:93, src/cluster_erp/modules/procurement/substitution_groups/services.py:203).
  • A breakdown appears once per group among live members (src/cluster_erp/modules/procurement/substitution_groups/models.py:58-66, src/cluster_erp/modules/procurement/substitution_groups/services.py:208-228).
  • The last member of a group cannot be removed (src/cluster_erp/modules/procurement/substitution_groups/services.py:308-322).
  • GetSubstitutesForProduct skips inactive groups and members outside their validity window, and sorts by preference_order (src/cluster_erp/modules/procurement/module.py:604-652).
  • A purchase request whose items include an active critical material gets priority high (src/cluster_erp/modules/procurement/purchase_requests/services.py:270-273).
  • MRP emits CriticalMaterialAlert once per product when the planned order date is within the product's alert threshold (src/cluster_erp/modules/procurement/mrp/engine.py:4090-4118).

Terms introduced

Term Code identifier Definition Turkish term Source
critical material CriticalMaterial A material flagged so that MRP and purchasing treat its shortage with priority. Kritik malzeme src/cluster_erp/modules/procurement/critical_materials/models.py:12
substitution group MaterialSubstitutionGroup A set of product breakdowns that can replace each other. İkame grubu src/cluster_erp/modules/procurement/substitution_groups/models.py:24
conversion factor conversion_factor The quantity ratio applied when a member replaces another. Dönüşüm katsayısı src/cluster_erp/modules/procurement/substitution_groups/models.py:99-104

Verified against commit 92f8051 on 2026-11-13.

Verified against commit 92f8051 · 2026-11-13