Skip to content

Inventory

Boris Buliga edited this page Sep 15, 2024 · 3 revisions

Inventory

Vino includes a cellar tracking solution, though it must be enabled to use. The inventory module offers the following features:

  • Acquire and consume bottles of a given wine entry:
    • Each bottle is assigned a unique ID.
    • Each bottle has its own acquisition price. Prices can be in any currency, but if not in USD, a price in USD must also be provided. Currently, you cannot configure a default currency.
    • Each bottle has its own location.
    • You can leave comments on each bottle.
  • All information is stored in a separate database located at vino-inv-db-file. This database is the source of truth and should be securely stored.
  • A simple UI for managing available bottles is provided. See vino-inv-ui and vino-inv-ui-mode-map.

Note: This module is in a 'beta' state, with many planned features yet to be implemented.

Initial Setup

To set up the inventory module, call vino-inv-setup after vino-setup:

;; configure vino
(vino-setup)

;; configure and initialize vino-inv
(setq-default vino-inv-db-file (expand-file-name "wine.db" org-directory)) ; optional
(vino-inv-setup) ; mandatory

;; if you want to acquire bottles when new entry is created
(add-hook 'vino-entry-create-handle-functions #'vino-inv-acquire)

Hooks

For extensibility, vino-inv provides a few abnormal hooks related to the bottle life-cycle:

  • vino-inv-acquire-handle-functions is run whenever a bottle is acquired. The hook is called with a single argument - vino-inv-bottle.
  • vino-inv-consume-handle-functions is run whenever a bottle is consumed. The hook is called with three arguments - vino-inv-bottle, action (string), and date (internal time).

The bottle structure is defined as follows:

(cl-defstruct vino-inv-bottle id wine purchase-date price price-usd location source comment)

UI

The inventory module includes a simple UI that displays all available bottles. Refer to vino-inv-ui-mode-map for available actions.