---
title: "Point of Sale"
description: "Handel detaliczny i gastronomia. Każda aplikacja jest modułem na jednym modelu danych."
canonical: "https://obop.dev/pl/apps/pos/"
lang: "pl"
---

# Point of Sale

## Do czego służy

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.

## Co pakiet robi, a czego nie robi

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.

## Modele

### `pos_config`

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

Grupa odczytu: `pos.user`. Grupa zapisu: `pos.manager`.

| Pole | Rodzaj | Klasa danych | Dane osobowe | Grupa | Agenci widzą | Opis |
|---|---|---|---|---|---|---|
| `name` | text | `none` | nie | `pos.user` | jawnie | Name of the till or shop, for example Main street shop |
| `currency` | text | `none` | nie | `pos.user` | jawnie | ISO 4217 currency code, for example EUR |
| `receipt_header` | longtext | `none` | nie | `pos.user` | jawnie | Text printed at the top of receipts |
| `cash_control` | bool | `none` | nie | `pos.user` | jawnie | Whether sessions must count the cash in the drawer when they open and close |
| `default_opening_cash` | money | `none` | nie | `pos.user` | jawnie | Cash normally left in the drawer overnight (minor currency units) |
| `allow_refunds` | bool | `none` | nie | `pos.user` | jawnie | Whether cashiers may propose refunds at this point of sale |
| `active` | bool | `none` | nie | `pos.user` | jawnie | 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

Grupa odczytu: `pos.user`. Grupa zapisu: `pos.user`.

| Pole | Rodzaj | Klasa danych | Dane osobowe | Grupa | Agenci widzą | Opis |
|---|---|---|---|---|---|---|
| `config_id` | ref → pos_config | `none` | nie | `pos.user` | jawnie | The point of sale the session belongs to |
| `cashier` | text | `internal` | tak | `pos.user` | zamaskowane | Name of the cashier who opened the session |
| `opened_on` | date | `none` | nie | `pos.user` | jawnie | Day the session was opened (YYYY-MM-DD) |
| `closed_on` | date | `none` | nie | `pos.user` | jawnie | Day the session was closed (YYYY-MM-DD) |
| `opening_cash` | money | `financial` | nie | `pos.user` | wstrzymane | Cash counted in the drawer at opening (minor currency units) |
| `expected_cash` | money | `financial` | nie | `pos.user` | wstrzymane | Cash the drawer should hold at closing: opening cash plus cash payments (entered, not computed) |
| `closing_cash` | money | `financial` | nie | `pos.user` | wstrzymane | Cash actually counted in the drawer at closing |
| `cash_difference` | money | `financial` | nie | `pos.user` | wstrzymane | Closing cash minus expected cash; negative means money is missing |
| `note` | longtext | `none` | nie | `pos.user` | jawnie | Explanation for any cash difference |
| `state` | select (open, closed) | `none` | nie | `pos.user` | jawnie | Session status: open, closed |

### `pos_order`

A sale rung up at a point of sale

Grupa odczytu: `pos.user`. Grupa zapisu: `pos.user`.

| Pole | Rodzaj | Klasa danych | Dane osobowe | Grupa | Agenci widzą | Opis |
|---|---|---|---|---|---|---|
| `session_id` | ref → pos_session | `none` | nie | `pos.user` | jawnie | The session the sale was made in |
| `receipt_number` | text | `none` | nie | `pos.user` | jawnie | Number printed on the receipt. Free text: packages cannot generate sequences |
| `ordered_on` | date | `none` | nie | `pos.user` | jawnie | Day of the sale (YYYY-MM-DD) |
| `customer_id` | ref → party | `none` | nie | `pos.user` | jawnie | The customer, when one was identified |
| `tax_total` | money | `none` | nie | `pos.user` | jawnie | Tax included in the total (minor currency units) |
| `total` | money | `none` | nie | `pos.user` | jawnie | Total paid by the customer including tax (minor currency units, entered not computed) |
| `note` | longtext | `none` | nie | `pos.user` | jawnie | Remark about the sale |
| `state` | select (draft, paid, refunded, cancelled) | `none` | nie | `pos.user` | jawnie | Sale status: draft, paid, refunded, cancelled |

### `pos_order_line`

One product line of a sale

Grupa odczytu: `pos.user`. Grupa zapisu: `pos.user`.

| Pole | Rodzaj | Klasa danych | Dane osobowe | Grupa | Agenci widzą | Opis |
|---|---|---|---|---|---|---|
| `order_id` | ref → pos_order | `none` | nie | `pos.user` | jawnie | The sale the line belongs to |
| `product_id` | ref → product | `none` | nie | `pos.user` | jawnie | The product sold |
| `description` | text | `none` | nie | `pos.user` | jawnie | Text shown on the receipt |
| `quantity` | number | `none` | nie | `pos.user` | jawnie | Units sold |
| `unit_price` | money | `none` | nie | `pos.user` | jawnie | Price per unit including tax (minor currency units) |
| `discount_bp` | number | `none` | nie | `pos.user` | jawnie | Discount in basis points: 1000 means 10.00 percent |
| `subtotal` | money | `none` | nie | `pos.user` | jawnie | 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

Grupa odczytu: `pos.user`. Grupa zapisu: `pos.user`.

| Pole | Rodzaj | Klasa danych | Dane osobowe | Grupa | Agenci widzą | Opis |
|---|---|---|---|---|---|---|
| `order_id` | ref → pos_order | `none` | nie | `pos.user` | jawnie | The sale the payment is for |
| `method` | select (cash, card, bank_transfer, voucher, other) | `none` | nie | `pos.user` | jawnie | How the customer paid: cash, card, bank_transfer, voucher, other |
| `amount` | money | `financial` | nie | `pos.user` | wstrzymane | Amount paid with this method (minor currency units) |
| `paid_on` | date | `none` | nie | `pos.user` | jawnie | Day of the payment (YYYY-MM-DD) |
| `provider_reference` | text | `financial` | tak | `pos.user` | wstrzymane | Reference from the card terminal or payment provider; never a card number |

## Przepływy pracy

### `pos_session`

| Akcja | Przenosi | Kto może uruchomić | Zatwierdzenie |
|---|---|---|---|
| `pos_session.close` | state: open → closed | `pos.manager` | tak |

### `pos_order`

| Akcja | Przenosi | Kto może uruchomić | Zatwierdzenie |
|---|---|---|---|
| `pos_order.pay` | state: draft → paid | `pos.user` | nie |
| `pos_order.cancel` | state: draft → cancelled | `pos.user` | nie |
| `pos_order.refund` | state: paid → refunded | `pos.manager` | tak |

## Grupy uprawnień

Grupy używane przez tę aplikację:

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

## Kroki zatwierdzania

Kroki, które agent może tylko zaproponować:

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

## Co agenci mogą, a czego nie mogą

Agent może odczytywać, wyszukiwać, tworzyć i aktualizować rekordy tej aplikacji oraz uruchamiać akcje niewymagające zatwierdzenia, w ramach grup uprawnień swojego tokenu.

Te kroki może tylko zaproponować, a człowiek musi je zatwierdzić: `pos_session.close`, `pos_order.refund`, `pos_config.delete`, `pos_session.delete`, `pos_order.delete`, `pos_order_line.delete`, `pos_payment.delete`.

Dane osobowe są maskowane jako tokeny zastępcze: `pos_session.cashier`.

Te pola są całkowicie wstrzymane i niedostępne dla agentów: `pos_session.opening_cash`, `pos_session.expected_cash`, `pos_session.closing_cash`, `pos_session.cash_difference`, `pos_payment.amount`, `pos_payment.provider_reference`.

## Zależności

- `base`
- `product`

## Instalacja

Zainstaluj ją w aplikacji Customize (Marketplace) lub z wiersza poleceń:

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

Wymaga bazy danych i uprawnień administratora.

## Zbuduj własną

[Przewodnik po modułach pokazuje, jak pisze się takie aplikacje](/pl/docs/reference/module-manifest/)
