---
title: "Point of Sale"
description: "Kauppa ja ravintola. Jokainen sovellus on moduuli samalla tietomallilla."
canonical: "https://obop-platform.sliplane.app/fi/apps/pos/"
lang: "fi"
---

# Point of Sale

## Mihin se on tarkoitettu

Model a shop till: configuration, cash-controlled sessions, orders with lines and payment lines per method. It records what happened at the till; it is not a payment terminal integration, and card numbers must never be stored.

## Mitä paketti tekee ja mitä ei

Shop tills: a point-of-sale configuration, cash-controlled sessions that are opened and closed, orders with lines, and payment lines per method. A refund and the closing of a session need a human approval from a manager; agents may only propose them. Totals, change and cash differences are entered, not computed. Card numbers must never be stored; keep only the payment provider's reference. Needs the Products package.

## Mallit

### `pos_config`

A point of sale (a till or a shop) and its rules

Lukuryhmä: `pos.user`. Kirjoitusryhmä: `pos.manager`.

| Kenttä | Tyyppi | Tietoluokka | Henkilötieto | Ryhmä | Agentit näkevät | Kuvaus |
|---|---|---|---|---|---|---|
| `name` | text | `none` | ei | `pos.user` | selkoisena | Name of the till or shop, for example Main street shop |
| `currency` | text | `none` | ei | `pos.user` | selkoisena | ISO 4217 currency code, for example EUR |
| `receipt_header` | longtext | `none` | ei | `pos.user` | selkoisena | Text printed at the top of receipts |
| `cash_control` | bool | `none` | ei | `pos.user` | selkoisena | Whether sessions must count the cash in the drawer when they open and close |
| `default_opening_cash` | money | `none` | ei | `pos.user` | selkoisena | Cash normally left in the drawer overnight (minor currency units) |
| `allow_refunds` | bool | `none` | ei | `pos.user` | selkoisena | Whether cashiers may propose refunds at this point of sale |
| `active` | bool | `none` | ei | `pos.user` | selkoisena | Whether the point of sale is in use |

### `pos_session`

One shift of selling at a point of sale, from opening to closing the cash drawer

Lukuryhmä: `pos.user`. Kirjoitusryhmä: `pos.user`.

| Kenttä | Tyyppi | Tietoluokka | Henkilötieto | Ryhmä | Agentit näkevät | Kuvaus |
|---|---|---|---|---|---|---|
| `config_id` | ref → pos_config | `none` | ei | `pos.user` | selkoisena | The point of sale the session belongs to |
| `cashier` | text | `internal` | kyllä | `pos.user` | maskattu | Name of the cashier who opened the session |
| `opened_on` | date | `none` | ei | `pos.user` | selkoisena | Day the session was opened (YYYY-MM-DD) |
| `closed_on` | date | `none` | ei | `pos.user` | selkoisena | Day the session was closed (YYYY-MM-DD) |
| `opening_cash` | money | `financial` | ei | `pos.user` | pidätetty | Cash counted in the drawer at opening (minor currency units) |
| `expected_cash` | money | `financial` | ei | `pos.user` | pidätetty | Cash the drawer should hold at closing: opening cash plus cash payments (entered, not computed) |
| `closing_cash` | money | `financial` | ei | `pos.user` | pidätetty | Cash actually counted in the drawer at closing |
| `cash_difference` | money | `financial` | ei | `pos.user` | pidätetty | Closing cash minus expected cash; negative means money is missing |
| `note` | longtext | `none` | ei | `pos.user` | selkoisena | Explanation for any cash difference |
| `state` | select (open, closed) | `none` | ei | `pos.user` | selkoisena | Session status: open, closed |

### `pos_order`

A sale rung up at a point of sale

Lukuryhmä: `pos.user`. Kirjoitusryhmä: `pos.user`.

| Kenttä | Tyyppi | Tietoluokka | Henkilötieto | Ryhmä | Agentit näkevät | Kuvaus |
|---|---|---|---|---|---|---|
| `session_id` | ref → pos_session | `none` | ei | `pos.user` | selkoisena | The session the sale was made in |
| `receipt_number` | text | `none` | ei | `pos.user` | selkoisena | Number printed on the receipt. Free text: packages cannot generate sequences |
| `ordered_on` | date | `none` | ei | `pos.user` | selkoisena | Day of the sale (YYYY-MM-DD) |
| `customer_id` | ref → party | `none` | ei | `pos.user` | selkoisena | The customer, when one was identified |
| `tax_total` | money | `none` | ei | `pos.user` | selkoisena | Tax included in the total (minor currency units) |
| `total` | money | `none` | ei | `pos.user` | selkoisena | Total paid by the customer including tax (minor currency units, entered not computed) |
| `note` | longtext | `none` | ei | `pos.user` | selkoisena | Remark about the sale |
| `state` | select (draft, paid, refunded, cancelled) | `none` | ei | `pos.user` | selkoisena | Sale status: draft, paid, refunded, cancelled |

### `pos_order_line`

One product line of a sale

Lukuryhmä: `pos.user`. Kirjoitusryhmä: `pos.user`.

| Kenttä | Tyyppi | Tietoluokka | Henkilötieto | Ryhmä | Agentit näkevät | Kuvaus |
|---|---|---|---|---|---|---|
| `order_id` | ref → pos_order | `none` | ei | `pos.user` | selkoisena | The sale the line belongs to |
| `product_id` | ref → product | `none` | ei | `pos.user` | selkoisena | The product sold |
| `description` | text | `none` | ei | `pos.user` | selkoisena | Text shown on the receipt |
| `quantity` | number | `none` | ei | `pos.user` | selkoisena | Units sold |
| `unit_price` | money | `none` | ei | `pos.user` | selkoisena | Price per unit including tax (minor currency units) |
| `discount_bp` | number | `none` | ei | `pos.user` | selkoisena | Discount in basis points: 1000 means 10.00 percent |
| `subtotal` | money | `none` | ei | `pos.user` | selkoisena | Line total after discount (minor currency units, entered not computed) |

### `pos_payment`

A payment received against a sale; a sale may be paid with several methods

Lukuryhmä: `pos.user`. Kirjoitusryhmä: `pos.user`.

| Kenttä | Tyyppi | Tietoluokka | Henkilötieto | Ryhmä | Agentit näkevät | Kuvaus |
|---|---|---|---|---|---|---|
| `order_id` | ref → pos_order | `none` | ei | `pos.user` | selkoisena | The sale the payment is for |
| `method` | select (cash, card, bank_transfer, voucher, other) | `none` | ei | `pos.user` | selkoisena | How the customer paid: cash, card, bank_transfer, voucher, other |
| `amount` | money | `financial` | ei | `pos.user` | pidätetty | Amount paid with this method (minor currency units) |
| `paid_on` | date | `none` | ei | `pos.user` | selkoisena | Day of the payment (YYYY-MM-DD) |
| `provider_reference` | text | `financial` | kyllä | `pos.user` | pidätetty | Reference from the card terminal or payment provider; never a card number |

## Työnkulut

### `pos_session`

| Toiminto | Siirtää | Kuka voi suorittaa | Hyväksyntä |
|---|---|---|---|
| `pos_session.close` | state: open → closed | `pos.manager` | kyllä |

### `pos_order`

| Toiminto | Siirtää | Kuka voi suorittaa | Hyväksyntä |
|---|---|---|---|
| `pos_order.pay` | state: draft → paid | `pos.user` | ei |
| `pos_order.cancel` | state: draft → cancelled | `pos.user` | ei |
| `pos_order.refund` | state: paid → refunded | `pos.manager` | kyllä |

## Käyttöoikeusryhmät

Tämän sovelluksen käyttämät ryhmät:

- `pos.manager`
- `pos.user`

## Hyväksyntävaiheet

Vaiheet, joita agentti voi vain ehdottaa:

- `pos_session.close`
- `pos_order.refund`

## Mitä agentit voivat ja eivät voi tehdä

Agentti voi lukea, hakea, luoda ja päivittää tämän sovelluksen tietueita sekä suorittaa toiminnot, jotka eivät vaadi hyväksyntää, tunnisteensa käyttöoikeusryhmien rajoissa.

Se voi vain ehdottaa näitä vaiheita, ja ihmisen on hyväksyttävä ne: `pos_session.close`, `pos_order.refund`, `pos_config.delete`, `pos_session.delete`, `pos_order.delete`, `pos_order_line.delete`, `pos_payment.delete`.

Henkilötiedot maskataan paikkamerkeiksi: `pos_session.cashier`.

Nämä kentät pidätetään agenteilta kokonaan: `pos_session.opening_cash`, `pos_session.expected_cash`, `pos_session.closing_cash`, `pos_session.cash_difference`, `pos_payment.amount`, `pos_payment.provider_reference`.

## Riippuvuudet

- `base`
- `product`

## Asennus

Asenna se Customize-sovelluksesta (Marketplace) tai komentoriviltä:

```bash
obop modules install-from pos
```

Vaatii tietokannan ja ylläpitäjän oikeudet.

## Tee oma

[Moduulioppaassa näytetään, miten tällaiset sovellukset kirjoitetaan](/fi/docs/reference/module-manifest/)
