Skip to content

fix(purchasing): allow 5-decimal unit price precision on purchase orders#1218

Open
carbon-agent wants to merge 1 commit into
mainfrom
agent/po-unit-price-precision-1203
Open

fix(purchasing): allow 5-decimal unit price precision on purchase orders#1218
carbon-agent wants to merge 1 commit into
mainfrom
agent/po-unit-price-precision-1203

Conversation

@carbon-agent

@carbon-agent carbon-agent commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Problem

Unit prices on purchase orders were clamped to two decimal places at input time, preventing accurate recording of real per-unit prices that carry more decimals (e.g. fasteners/raw material quoted at $0.00123). The underlying columns already support five decimals (NUMERIC(16,5)).

Root cause

The currency-styled price inputs passed only { style: "currency", currency } to Intl.NumberFormat, which defaults maximumFractionDigits to 2 — clamping both entry and display to two decimals.

Fix

Add explicit minimumFractionDigits: 2, maximumFractionDigits: 5 to the currency price inputs so up to 5 decimals can be entered, preserved on save, and displayed, while existing 2-decimal values render unchanged.

Files touched:

  • PurchaseOrderLineForm.tsx — item and indirect branches (unit price, shipping, tax amount)
  • PurchaseOrderDeliveryForm.tsx — shipping cost
  • SupplierQuoteLinePricing.tsx — supplier unit price, shipping, tax amount
  • SupplierProcessForm.tsx — minimum cost

Acceptance criteria

  • Users can enter unit prices with up to 5 decimal places
  • Entered precision is preserved when saved (matches NUMERIC(16,5))
  • Display formatting shows up to 5 decimals (no premature rounding)
  • Existing 2-decimal values continue to display correctly (minimumFractionDigits: 2)

Verification

  • pnpm exec turbo run typecheck --filter=erp — ✅ passes
  • biome check on the 4 files — ✅ clean

No schema changes; no new strings.

Closes #1203

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved currency formatting for supplier shipping costs and minimum costs.
    • Currency values now display with consistent precision, including two required decimal places and up to five decimal places where applicable.
    • Standardized currency display across purchase order lines and supplier quote pricing for unit prices, shipping, and tax amounts.

Currency-styled price inputs passed only `style`/`currency` to
Intl.NumberFormat, which defaults maximumFractionDigits to 2 and clamped
entry/display to two decimals. The underlying columns are NUMERIC(16,5),
so real per-unit prices like $0.00123 could not be recorded.

Add explicit `minimumFractionDigits: 2, maximumFractionDigits: 5` to the
currency price inputs so up to 5 decimals can be entered, preserved, and
displayed while existing 2-decimal values render unchanged:

- PurchaseOrderLineForm (item + indirect branches: unit price, shipping,
  tax amount)
- PurchaseOrderDeliveryForm (shipping cost)
- SupplierQuoteLinePricing (unit price, shipping, tax amount)
- SupplierProcessForm (minimum cost)

Closes #1203

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
carbon Ready Ready Preview, Comment Jul 23, 2026 10:08pm
3 Skipped Deployments
Project Deployment Actions Updated (UTC)
academy Skipped Skipped Jul 23, 2026 10:08pm
docs Skipped Skipped Jul 23, 2026 10:08pm
mes Skipped Skipped Jul 23, 2026 10:08pm

Request Review

@github-actions github-actions Bot added erp complexity: low Low-complexity PR labels Jul 23, 2026
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e04c6e28-6b3c-4821-aa25-01b42f3f595f

📥 Commits

Reviewing files that changed from the base of the PR and between 92e19c0 and b1963a8.

📒 Files selected for processing (4)
  • apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm.tsx
  • apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx
  • apps/erp/app/modules/purchasing/ui/Supplier/SupplierProcessForm.tsx
  • apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteLinePricing.tsx

📝 Walkthrough

Walkthrough

Purchasing currency inputs now specify fractional precision up to five digits where needed. Related purchase order and supplier quote currency expressions were reformatted without changing their behavior.

Changes

Purchasing currency precision

Layer / File(s) Summary
Purchase order currency precision
apps/erp/app/modules/purchasing/ui/PurchaseOrder/*
Delivery cost formatting adds currency style and two-to-five fractional digit limits; purchase order line currency fallbacks are reformatted without logic changes.
Supplier pricing currency formatting
apps/erp/app/modules/purchasing/ui/Supplier/SupplierProcessForm.tsx, apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteLinePricing.tsx
Supplier minimum cost adds fractional digit limits, while supplier quote pricing, shipping, and tax currency options retain their existing precision settings.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • crbnos/carbon#1205: Updates the same purchasing currency inputs and fractional digit formatting options.

Suggested reviewers: barbinbrad

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main change: increasing purchasing price precision to five decimals on purchase orders.
Linked Issues check ✅ Passed The PR preserves up to five-decimal precision for purchase order price inputs, matching issue #1203's requirement.
Out of Scope Changes check ✅ Passed The additional form updates align with the stated goal of applying the same precision handling across related purchasing screens.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/po-unit-price-precision-1203

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

checks: passing CI checks passed complexity: low Low-complexity PR erp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Purchase order unit prices are rounded to 2 decimal places (no way to increase precision)

1 participant