Skip to content

Warehouse 0.2.2: Posting a goods receipt updates the stock's unit value

Warehouse 0.2.2 makes a posted goods receipt set the unit value of the stock it adds, so the stock page shows what the goods last cost.

Goods receipt lines created from a supplier order already carried the order’s price. Posting the receipt now writes that price into the stock’s unit value for the item at the receiving warehouse. The last posted receipt wins. A line without a price leaves the unit value as it was.

Supplier order generation still picks the item’s primary supplier first and the manufacturer’s suppliers second, as in 0.2.1.

Full release notes: Warehouse 0.2.2

0.2.2 · 14 July 2026

Added

  • Goods receipt lines can now set stock unit_value on posting (PR #5). When a receipt line carries a "unit_value" field, posting writes it to phoenix_kit_warehouse_stock.unit_value for that item/location via StockLedger.receive_quantity/3’s existing :unit_value option (last posted receipt wins). Absent/nil leaves the existing value untouched.

Fixed

  • resolve_suppliers/1 stopped honoring item.primary_supplier_uuid (PR #5 fix, applied during review). PR #5 rewrote supplier resolution to prefer a PhoenixKitCatalogue.Catalogue.Suppliers.primary_for_item/1 junction lookup, on the premise that core’s V149 migration removed the primary_supplier_uuid scalar. It didn’t: V149 is a purely additive per-supplier-pricing junction table, and the scalar remains the item’s documented default supplier. Against the pinned phoenix_kit_catalogue ~> 0.10 dependency, primary_for_item/1 doesn’t exist, so the new code silently fell through to manufacturer-only resolution — any item that relied on primary_supplier_uuid (generic/unbranded materials with no manufacturer, or breaking a tie between a manufacturer’s multiple linked suppliers) stopped auto-assigning a supplier during generate_from_internal_order/2. Reverted resolve_suppliers/1 to check primary_supplier_uuid first, manufacturer as fallback — the original pre-PR behavior. Full findings: dev_docs/pull_requests/2026/5-parties-resolver-unit-value/CLAUDE_REVIEW.md.

Warehouse 0.2.2. Install or update: {:phoenix_kit_warehouse, "~> 0.2"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.