[UI] Fix useReceiveLineItems bug (#12756)

- Prevent negative pre-fill values
This commit is contained in:
Oliver
2026-09-01 12:06:01 +10:00
committed by GitHub
parent 8ae579124b
commit f8328cd1db
@@ -908,7 +908,7 @@ export function useReceiveLineItems(props: LineItemsForm) {
// here would make the backend treat this line as if the user // here would make the backend treat this line as if the user
// had explicitly chosen the PO's default, blocking any override. // had explicitly chosen the PO's default, blocking any override.
location: elem.destination ?? null, location: elem.destination ?? null,
quantity: elem.quantity - elem.received, quantity: Math.max(0, elem.quantity - elem.received),
expiry_date: null, expiry_date: null,
batch_code: '', batch_code: '',
serial_numbers: '', serial_numbers: '',