Technical Reference: Price List¶
Entity: PriceList¶
The PriceList entity serves as a container for defining specific product prices. The prices themselves are not stored in the PriceList entity nor in the Product entity, but in the Join Table.
Entity Fields¶
| Name (CZ) | Name (System) | Type | Description |
|---|---|---|---|
| Name | name |
Varchar | Unique name of the price list. Required. |
| Description | description |
Text | Internal note. |
| Created At | createdAt |
Datetime | Creation date. Key for determining priority (LIFO). |
Relationships (Links)¶
| Link | Entity | Type | Description |
|---|---|---|---|
| Products | Product |
Many-to-Many | Contains price definitions. See "Price Storage" below. |
| Accounts | Account |
Many-to-Many | Accounts for which this price list is valid. |
Price Storage (Pivot Columns)¶
Prices are stored in additionalColumns in the products relationship (table price_list_product or similar, system-managed).
price(Float): Specific price of the product in this list.priceCurrency(Varchar): Currency of the price (e.g., 'CZK', 'EUR').
Price Application Logic (Client-side)¶
The price fetching mechanism is implemented in the client script (Frontend).
- When the
accountIdchanges on a document (Quote, Order), thePriceListcollection is fetched. - Filter:
linkedWith accounts = currentAccountId. - Sort:
createdAt DESC(newest first). - Limit: 1.
- When adding a product (
onChangeProductId), the script checks if a price list is loaded and if it contains the product. - If yes, it sets
unitPriceto the value from the price list.
Logic Location:
* client/src/extensions/views/fields/abstract-items.js
* client/src/extensions/handlers/dynamic/abstract-items.js