[UI] Fix useReceiveLineItems bug (#12756) (#12757)

- Prevent negative pre-fill values

(cherry picked from commit f8328cd1db)

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
github-actions[bot]
2026-09-01 12:55:56 +10:00
committed by GitHub
co-authored by Oliver
parent 2754f8c938
commit 7f9d89d144
@@ -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: '',