---
title: "Purchase"
description: "Toimittajat ja ostotilaukset. Jokainen sovellus on moduuli samalla tietomallilla."
canonical: "https://obop.dev/fi/apps/purchase/"
lang: "fi"
---

# Purchase

## Mihin se on tarkoitettu

Keep vendors and the purchase orders you send them, with order lines and a draft to received flow. Totals are entered, not summed from the lines.

## Mitä paketti tekee ja mitä ei

Vendors, purchase orders and order lines with a draft, sent, confirmed, received and cancelled flow. An order has a number from a series, its total is the sum of its lines, and receiving the goods creates a draft stock move per line at the receiving location (the warehouse validates them).

## Moduulin tiedot

- **Versio:** `0.3.0`
- **Tekijä:** SpaceCorps
- **Lisenssi:** [AGPL-3.0-or-later](https://spdx.org/licenses/AGPL-3.0-or-later.html)
- **Vaatii ytimen:** `^0.2` (nykyinen ydin on 0.2.0)
- **Kypsyys:** Beta
- **Luokat:** Toimitusketju

## Mallit

### `purchase_vendor`

Purchasing terms for a contact you buy from

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

| Kenttä | Tyyppi | Tietoluokka | Henkilötieto | Ryhmä | Agentit näkevät | Kuvaus |
|---|---|---|---|---|---|---|
| `party_id` | ref → party | `none` | ei | `purchase.user` | selkoisena | The contact record of the vendor |
| `vendor_reference` | text | `none` | ei | `purchase.user` | selkoisena | Your customer number at this vendor |
| `payment_terms_days` | number | `none` | ei | `purchase.user` | selkoisena | Days allowed to pay an invoice |
| `lead_time_days` | number | `none` | ei | `purchase.user` | selkoisena | Usual days between order and delivery |
| `iban` | text | `financial` | kyllä | `purchase.manager` | pidätetty | Bank account the vendor is paid into |
| `active` | bool | `none` | ei | `purchase.user` | selkoisena | Whether you still buy from this vendor |

### `purchase_order`

A request to a vendor to supply goods or services

Lukuryhmä: `purchase.user`. Kirjoitusryhmä: `purchase.user`.

| Kenttä | Tyyppi | Tietoluokka | Henkilötieto | Ryhmä | Agentit näkevät | Kuvaus |
|---|---|---|---|---|---|---|
| `number` | sequence | `none` | ei | `purchase.user` | selkoisena | Purchase order number such as PO-00042, assigned when the order is created |
| `reference` | text | `none` | ei | `purchase.user` | selkoisena | Order number printed on the document |
| `vendor_id` | ref → purchase_vendor | `none` | ei | `purchase.user` | selkoisena | The vendor ordered from |
| `ordered_on` | date | `none` | ei | `purchase.user` | selkoisena | Date the order was placed (YYYY-MM-DD) |
| `expected_on` | date | `none` | ei | `purchase.user` | selkoisena | Date the goods are expected (YYYY-MM-DD) |
| `currency` | text | `none` | ei | `purchase.user` | selkoisena | ISO 4217 currency code, for example EUR |
| `receive_location_id` | ref → inventory_location | `none` | ei | `purchase.user` | selkoisena | Where the goods are to be received; receiving the order creates the stock moves to this location |
| `total` | money | `none` | ei | `purchase.user` | selkoisena | Order total: the sum of the line amounts (minor currency units, e.g. cents) |
| `notes` | longtext | `none` | ei | `purchase.user` | selkoisena | Delivery instructions and remarks for the vendor |
| `state` | select (draft, sent, confirmed, received, cancelled) | `none` | ei | `purchase.user` | selkoisena | Order status: draft, sent, confirmed, received, cancelled |

### `purchase_order_line`

One product or service on a purchase order

Lukuryhmä: `purchase.user`. Kirjoitusryhmä: `purchase.user`.

| Kenttä | Tyyppi | Tietoluokka | Henkilötieto | Ryhmä | Agentit näkevät | Kuvaus |
|---|---|---|---|---|---|---|
| `order_id` | ref → purchase_order | `none` | ei | `purchase.user` | selkoisena | The order the line belongs to |
| `product_id` | ref → product | `none` | ei | `purchase.user` | selkoisena | The product ordered |
| `description` | text | `none` | ei | `purchase.user` | selkoisena | Wording for the vendor if different from the product name |
| `quantity` | number | `none` | ei | `purchase.user` | selkoisena | Units ordered |
| `unit_price` | money | `none` | ei | `purchase.user` | selkoisena | Agreed price per unit (minor currency units, e.g. cents) |
| `amount` | money | `none` | ei | `purchase.user` | selkoisena | Line amount: quantity times unit price (minor currency units) |
| `received_quantity` | number | `none` | ei | `purchase.user` | selkoisena | Units received so far |

## Työnkulut

### `purchase_order`

| Toiminto | Siirtää | Kuka voi suorittaa | Hyväksyntä |
|---|---|---|---|
| `purchase_order.send` | state: draft → sent | `purchase.user` | ei |
| `purchase_order.confirm` | state: sent → confirmed | `purchase.manager` | kyllä |
| `purchase_order.receive` | state: confirmed → received | `purchase.user` | ei |
| `purchase_order.cancel` | state: draft → cancelled | `purchase.user` | ei |

## Käyttöoikeusryhmät

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

- `purchase.manager`
- `purchase.user`

## Hyväksyntävaiheet

Vaiheet, joita agentti voi vain ehdottaa:

- `purchase_order.confirm`

## 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: `purchase_order.confirm`, `purchase_vendor.delete`, `purchase_order.delete`, `purchase_order_line.delete`.

Nämä kentät pidätetään agenteilta kokonaan: `purchase_vendor.iban`.

## Riippuvuudet

Jokainen riippuvuus kertoo hyväksymänsä versiot. Sisäänrakennetut sovellukset versioituvat ytimen mukana, joten niitä koskeva vaatimus tarkistetaan ytimen versiota vasten.

- [Contacts](/fi/apps/contacts/): `^0.2` (sisäänrakennettu)
- [Inventory](/fi/apps/inventory/): `>=0.3, <1`
- [Products](/fi/apps/products/): `^0.2` (sisäänrakennettu)

Kun tämä sovellus asennetaan moduulikaupasta, myös puuttuvat riippuvuudet asennetaan yhdessä suunnitelmassa, jonka vahvistat kerran.

## Asennus

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

```bash
obop modules install-from purchase
```

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

## Tee oma

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