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

Reference

Customers and customer parts

Reference for customers, customer_parts, and customer_part_revisions in crm, with the customer facet of a party, part number mapping, and revision lifecycle.

This page describes three sub-modules of src/cluster_erp/modules/crm/. customers/ holds the customer facet (Customer), the customer role record of a party. customer_parts/ maps a customer's part number to one of the company's products, and customer_part_revisions/ keeps the revisions of that part. The role model of parties is described on party unification.

Scope and source

  • Defined in: models.py, services.py, routes.py, and metadata.py of the three sub-modules, and the party handlers in src/cluster_erp/modules/crm/module.py:115-138 and src/cluster_erp/modules/crm/module.py:271-297.
  • Count: 3 tables; 6 customer routes, 6 customer part routes, and 7 revision routes (@router. decorators); 2 ActionMeta entries on revisions.

Customer fields

Name Meaning Source
code Business key from the yearly sequence customer src/cluster_erp/modules/crm/customers/models.py:21, src/cluster_erp/modules/crm/customers/services.py:108
party_id The party that plays the customer role src/cluster_erp/modules/crm/customers/models.py:23-28
legal_name, tax_no Copied from the party on create src/cluster_erp/modules/crm/customers/models.py:22, src/cluster_erp/modules/crm/customers/models.py:29
country_id Country reference src/cluster_erp/modules/crm/customers/models.py:30-35
default_incoterm, default_currency, payment_terms Commercial defaults read by new quotes src/cluster_erp/modules/crm/customers/models.py:36-38
sales_contact_email, default_account_manager_id Contact and account manager src/cluster_erp/modules/crm/customers/models.py:39-46
ariba_supplier_id The company's supplier id in the customer's procurement portal src/cluster_erp/modules/crm/customers/models.py:47-50
is_active, extra Active flag and tenant-defined field values src/cluster_erp/modules/crm/customers/models.py:17, src/cluster_erp/modules/crm/customers/models.py:51

Customer part and revision fields

Entity Fields Source
CustomerPart (crm_customer_parts) customer_id, part_id (a product), customer_part_no, customer_part_name, is_active, extra src/cluster_erp/modules/crm/customer_parts/models.py:13-52
CustomerPartRevision (crm_customer_part_revisions) customer_part_id, revision_no, status (default draft), description, drawing_doc_id, valid_from src/cluster_erp/modules/crm/customer_part_revisions/models.py:13-43

Revision statuses and actions

A revision is draft, active, or superseded (src/cluster_erp/modules/crm/customer_part_revisions/services.py:110-155).

stateDiagram-v2
 [*] --> draft
 draft --> active: activate
 active --> superseded: supersede

In prose: a draft becomes active only when the part has no other active revision. An active revision can be superseded. Only a draft can be edited or deleted (src/cluster_erp/modules/crm/customer_part_revisions/services.py:84-109).

Action Label Condition Endpoint Permission Source
activate Activate status is draft POST /customer-part-revisions/{id}/activate customer_part_revision.activate src/cluster_erp/modules/crm/customer_part_revisions/metadata.py:48-58, src/cluster_erp/modules/crm/customer_part_revisions/routes.py:103
supersede Supersede status is active POST /customer-part-revisions/{id}/supersede customer_part_revision.activate src/cluster_erp/modules/crm/customer_part_revisions/metadata.py:59-69, src/cluster_erp/modules/crm/customer_part_revisions/routes.py:118

Routes

Method and path Permission Source
GET, POST /customers/; GET, PUT, DELETE /customers/{customer_id}; POST /customers/bulk-delete customer.read, .create, .update, .delete, .bulk_delete src/cluster_erp/modules/crm/customers/routes.py:37-147
GET, POST /customer-parts/; GET, PUT, DELETE /customer-parts/{customer_part_id}; POST /customer-parts/bulk-delete customer_part.read, .create, .update, .delete, .bulk_delete src/cluster_erp/modules/crm/customer_parts/routes.py:47-157
GET, POST /customer-parts/{customer_part_id}/revisions; GET, PUT, DELETE /customer-part-revisions/{revision_id} customer_part_revision.read, .create, .update, .delete src/cluster_erp/modules/crm/customer_part_revisions/routes.py:24-91

Constraints and validation

  • On create, a customer with a party takes legal_name and tax_no from GetPartyById. A party plays the customer role once: a second create for the same party updates the existing facet (src/cluster_erp/modules/crm/customers/services.py:75-107).
  • Create emits CustomerCreated and PartyRoleSet with active=True; delete sets deleted_at and emits PartyRoleSet with active=False (src/cluster_erp/modules/crm/customers/services.py:118-145, src/cluster_erp/modules/crm/customers/services.py:196-215).
  • PartyUpdated copies a changed display name and tax id to the live facets; PartyDeleted sets is_active to false on them (src/cluster_erp/modules/crm/module.py:115-138, src/cluster_erp/modules/crm/module.py:271-297).
  • A customer part number is unique per customer among live rows (src/cluster_erp/modules/crm/customer_parts/models.py:15-22, src/cluster_erp/modules/crm/customer_parts/services.py:139-155).
  • Personal values of a facet of an individual party are collected and anonymised by privacy_handlers.py (src/cluster_erp/modules/crm/privacy_handlers.py:1-12).

Discrepancies

Terms introduced

Term Code identifier Definition Turkish term Source
customer part CustomerPart The customer's part number mapped to one of the company's products. Müşteri parçası src/cluster_erp/modules/crm/customer_parts/models.py:13
customer part revision CustomerPartRevision A numbered revision of a customer part with a drawing and validity. Müşteri parça revizyonu src/cluster_erp/modules/crm/customer_part_revisions/models.py:13

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

Verified against commit 92f8051 · 2026-11-13