Factorizer/Cluster ERP WikiCluster ERP Türkçe
Home / Platform

Reference

Reference data and core i18n

Where countries and currencies come from, the currency routes, the shared choice lists for Incoterms, blood groups, and diets, and the translation helpers in core/i18n.py.

This page lists the reference data that the platform core provides or seeds, and the small server-side translation helpers. It covers core/currencies.py, server/routes/currencies.py, core/incoterms.py, core/blood_group.py, core/diet.py, and core/i18n.py, and it states where country rows come from. Client-side translation files are documented on i18n and languages.

Scope and source

  • Defined in: the files above, plus the country model in src/cluster_erp/modules/parties/settings/models.py
  • Count: 2 seeded reference tables (core_currencies, parties_countries); 7 currency routes (counted from the @router. decorators in src/cluster_erp/server/routes/currencies.py); 3 choice lists with 11, 8, and 9 entries (counted from the ChoiceMeta( entries); 2 translation helpers

Currencies

core_currencies is defined in the core (src/cluster_erp/core/currencies.py:57-89) and seeded by the currencies module at start-up with CurrencyService.seed_iso_currencies (src/cluster_erp/modules/currencies/module.py:31-47). The seed takes a curated list with symbols and Turkish names, then adds every other ISO 4217 currency from pycountry; a currency whose numeric code is blank or already used is skipped (src/cluster_erp/core/currencies.py:559, src/cluster_erp/core/currencies.py:1811-1852). Existing codes are not overwritten (src/cluster_erp/core/currencies.py:281-290).

core_exchange_rates holds rates as Numeric(18, 6) with a source, TCMB by default (src/cluster_erp/core/currencies.py:91-132). See money and Decimal.

Currency routes

server/routes/currencies.py defines a router without a prefix. The currencies module includes it under its own prefix, so the paths are /api/v1/currencies/... (src/cluster_erp/server/routes/currencies.py:18, src/cluster_erp/modules/currencies/module.py:74-82).

Method and path Permission Purpose Source
GET / (query active_only, search) currency.read List currencies src/cluster_erp/server/routes/currencies.py:21-30
POST /update-from-internet currency.create Refresh the list from the ISO 4217 register in pycountry src/cluster_erp/server/routes/currencies.py:33-40
POST / currency.create Create a currency src/cluster_erp/server/routes/currencies.py:43-51
GET /{currency_id} currency.read Get one currency src/cluster_erp/server/routes/currencies.py:54-64
PUT /{currency_id} currency.update Change name, symbol, decimal places, translations, or active flag src/cluster_erp/server/routes/currencies.py:67-78
DELETE /{currency_id} currency.delete Deactivate a currency src/cluster_erp/server/routes/currencies.py:81-89
POST /seed currency.seed Run the ISO seed again src/cluster_erp/server/routes/currencies.py:92-98

Countries

Countries are rows of parties_countries, owned by the parties module (src/cluster_erp/modules/parties/settings/models.py:12-13). The module seeds the ISO 3166 list from pycountry at start-up and does not overwrite edited rows; telephone codes are left empty on purpose (src/cluster_erp/modules/parties/module.py:41-61, src/cluster_erp/modules/parties/settings/services.py:38-50). Other modules read a country through the query GetCountryByCode (src/cluster_erp/core/contracts.py:2529-2533). See settings and reference data.

Shared choice lists

These lists are ChoiceMeta objects used directly in module metadata.

Constant Entries Used in Source
INCOTERMS_2020 11 trade terms of Incoterms 2020, from EXW to DDP 11 files in src/cluster_erp/modules (purchasing documents) src/cluster_erp/core/incoterms.py:1-77
BLOOD_GROUP_CHOICES 8 ABO and Rh groups 2 files src/cluster_erp/core/blood_group.py:1-18
DIET_CHOICES 9 diet types, including other 2 files src/cluster_erp/core/diet.py:1-20

Usage counts were made with grep -rlw <name> over src/cluster_erp/modules and src/cluster_erp/server. Each entry carries its own English and Turkish label, for example src/cluster_erp/core/incoterms.py:12-15.

Translation helpers

Function Behaviour Source
resolve_display_name(translations, default_name, lang) Returns translations[lang]["name"] when it is a string, else default_name src/cluster_erp/core/i18n.py:6-17
resolve_field(translations, field, default_value, lang) The same for any field name src/cluster_erp/core/i18n.py:20-32

resolve_display_name is used in 5 files; resolve_field has no caller outside core/i18n.py (counted with grep -rlw). The request language comes from get_language, which reads the first two letters of Accept-Language and defaults to en (src/cluster_erp/server/dependencies.py:247-249).

Constraints and validation

  • A currency code used in a document must be an active row of core_currencies; assert_known_currency refuses others with CURRENCY_UNKNOWN and HTTP 422 (src/cluster_erp/core/currencies.py:30-49).
  • Currency and country codes are unique among live rows only (src/cluster_erp/core/currencies.py:61-74, src/cluster_erp/modules/parties/settings/models.py:15-34).

Discrepancies

Terms introduced

Term Code identifier Definition Turkish term Source
reference data core_currencies, parties_countries Standard lists seeded into the database instead of written into code. referans veri src/cluster_erp/core/currencies.py:57
Incoterms INCOTERMS_2020 The 11 international trade terms published by the ICC in 2020. Incoterms src/cluster_erp/core/incoterms.py:11

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

Verified against commit 92f8051 · 2026-11-13