---
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. Order totals are entered, not summed from the lines.

## 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 |
|---|---|---|---|---|---|---|
| `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 |
| `total` | money | `none` | ei | `purchase.user` | selkoisena | Order total as agreed with the vendor (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) |
| `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

- `base`
- `product`

## 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/)
