This page describes the suppliers sub-module in src/cluster_erp/modules/procurement/suppliers/. A supplier (Supplier) is the supplier role record of a party: it adds purchasing defaults to a party and is shown as a section of the party card. The party itself is described on parties, and the role model on party unification.
Scope and source¶
- Defined in:
src/cluster_erp/modules/procurement/suppliers/models.py(Supplier),services.py(SupplierService),routes.py,metadata.py, and the party handlers insrc/cluster_erp/modules/procurement/module.py:221-276. - Count: 1 table, 6 routes (
@router.decorators inroutes.py).
Supplier fields¶
| Name | Meaning | Source |
|---|---|---|
code |
Business key from the yearly sequence supplier |
src/cluster_erp/modules/procurement/suppliers/models.py:40, src/cluster_erp/modules/procurement/suppliers/services.py:130 |
party_id |
The party that plays the supplier role; one live facet per party | src/cluster_erp/modules/procurement/suppliers/models.py:32-36, src/cluster_erp/modules/procurement/suppliers/models.py:42-47 |
legal_name, tax_no |
Copied from the party's display name and tax id | src/cluster_erp/modules/procurement/suppliers/models.py:41, src/cluster_erp/modules/procurement/suppliers/models.py:48 |
country_id |
Country reference | src/cluster_erp/modules/procurement/suppliers/models.py:49-54 |
default_incoterm, default_currency, payment_terms |
Commercial defaults | src/cluster_erp/modules/procurement/suppliers/models.py:55-57 |
purchasing_contact_email, default_buyer_id |
Contact and responsible buyer | src/cluster_erp/modules/procurement/suppliers/models.py:58-59 |
vendor_number |
Number the company uses for the vendor; unique among live rows when set | src/cluster_erp/modules/procurement/suppliers/models.py:26-31, src/cluster_erp/modules/procurement/suppliers/models.py:60 |
is_preferred |
Preferred vendor flag | src/cluster_erp/modules/procurement/suppliers/models.py:61-67 |
is_active, extra |
Active flag and tenant-defined field values | src/cluster_erp/modules/procurement/suppliers/models.py:21, src/cluster_erp/modules/procurement/suppliers/models.py:68 |
Supplier routes¶
| Method and path | Permission | Source |
|---|---|---|
GET /suppliers/ |
supplier.read |
src/cluster_erp/modules/procurement/suppliers/routes.py:37 |
POST /suppliers/ |
supplier.create |
src/cluster_erp/modules/procurement/suppliers/routes.py:73 |
GET /suppliers/{supplier_id} |
supplier.read |
src/cluster_erp/modules/procurement/suppliers/routes.py:92 |
PUT /suppliers/{supplier_id} |
supplier.update |
src/cluster_erp/modules/procurement/suppliers/routes.py:113 |
DELETE /suppliers/{supplier_id} |
supplier.delete |
src/cluster_erp/modules/procurement/suppliers/routes.py:135 |
POST /suppliers/bulk-delete |
supplier.bulk_delete |
src/cluster_erp/modules/procurement/suppliers/routes.py:147 |
The paths sit under /api/v1/procurement. The party card also creates supplier facets through the composite party form, which declares the role supplier (src/cluster_erp/modules/parties/parties/metadata.py:323).
Party synchronisation¶
The diagram shows how the facet follows its party.
flowchart LR C["SupplierService.create"] --> GP["GetPartyById"] GP --> F["legal_name and tax_no from the party"] C --> RS["PartyRoleSet role supplier active true"] PU["PartyUpdated"] --> U["update legal_name or tax_no"] PD["PartyDeleted"] --> D["is_active false on live facets"] X["SupplierService.delete"] --> RS2["PartyRoleSet role supplier active false"]
In prose: on create, the service reads the party with GetPartyById and copies its display name and tax id; an unknown party is refused with a 422 error (src/cluster_erp/modules/procurement/suppliers/services.py:80-128). It then emits PartyRoleSet with active=True (src/cluster_erp/modules/procurement/suppliers/services.py:135-145). An update drops legal_name and tax_no from the payload when the facet has a party (src/cluster_erp/modules/procurement/suppliers/services.py:158-162). PartyUpdated copies only the changed fields to the live facets (src/cluster_erp/modules/procurement/module.py:221-246). PartyDeleted sets is_active to false on the live facets of that party (src/cluster_erp/modules/procurement/module.py:248-273). Delete and bulk delete set deleted_at and emit PartyRoleSet with active=False (src/cluster_erp/modules/procurement/suppliers/services.py:185-241).
Constraints and validation¶
vendor_numberandparty_idare each unique among live rows when set (src/cluster_erp/modules/procurement/suppliers/models.py:24-38).party_idandcountry_idare database foreign keys toparties_partiesandparties_countries(src/cluster_erp/modules/procurement/suppliers/models.py:42-54).- Personal values of a facet of an individual party are collected and anonymised by
privacy_handlers.py(src/cluster_erp/modules/procurement/privacy_handlers.py:1-11).
Terms introduced¶
| Term | Code identifier | Definition | Turkish term | Source |
|---|---|---|---|---|
| vendor number | vendor_number |
The number the company uses for a vendor, unique among live suppliers. | Tedarikçi numarası | src/cluster_erp/modules/procurement/suppliers/models.py:60 |
| preferred vendor | is_preferred |
A supplier the buyer prefers to source from. | Tercih edilen tedarikçi | src/cluster_erp/modules/procurement/suppliers/models.py:61-67 |
Related pages¶
Verified against commit 92f8051 on 2026-11-13.