From 7f9d89d144fada5391b87c28aa189916e618a76f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 1 Sep 2026 12:55:56 +1000 Subject: [PATCH] [UI] Fix useReceiveLineItems bug (#12756) (#12757) - Prevent negative pre-fill values (cherry picked from commit f8328cd1db5c4a679993224f5316b3648642218b) Co-authored-by: Oliver --- src/frontend/src/forms/PurchaseOrderForms.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/forms/PurchaseOrderForms.tsx b/src/frontend/src/forms/PurchaseOrderForms.tsx index fb5f9a9b06..ffc27ebd99 100644 --- a/src/frontend/src/forms/PurchaseOrderForms.tsx +++ b/src/frontend/src/forms/PurchaseOrderForms.tsx @@ -907,7 +907,7 @@ export function useReceiveLineItems(props: LineItemsForm) { // here would make the backend treat this line as if the user // had explicitly chosen the PO's default, blocking any override. location: elem.destination ?? null, - quantity: elem.quantity - elem.received, + quantity: Math.max(0, elem.quantity - elem.received), expiry_date: null, batch_code: '', serial_numbers: '',