[UI] Fix serial and batch code generators (#9772)

* Tweak stock item form

- Fix batch code placeholder
- Fix serial number placeholder

* Tweak build output form

* More cleanup

* Fix for PurchaseOrderForm

* Refactoring placeholder values
This commit is contained in:
Oliver
2025-06-13 20:02:30 +10:00
committed by GitHub
parent 5bf94acc1a
commit b465900344
9 changed files with 136 additions and 157 deletions
+14 -8
View File
@@ -295,16 +295,20 @@ function LineItemFormRow({
}, [record.destination]);
// Batch code generator
const batchCodeGenerator = useBatchCodeGenerator((value: any) => {
if (value) {
props.changeFn(props.idx, 'batch_code', value);
const batchCodeGenerator = useBatchCodeGenerator({
onGenerate: (value: any) => {
if (value) {
props.changeFn(props.idx, 'batch_code', value);
}
}
});
// Serial number generator
const serialNumberGenerator = useSerialNumberGenerator((value: any) => {
if (value) {
props.changeFn(props.idx, 'serial_numbers', value);
const serialNumberGenerator = useSerialNumberGenerator({
onGenerate: (value: any) => {
if (value) {
props.changeFn(props.idx, 'serial_numbers', value);
}
}
});
@@ -478,8 +482,10 @@ function LineItemFormRow({
fieldDefinition={{
field_type: 'number',
value: props.item.quantity,
onValueChange: (value) =>
props.changeFn(props.idx, 'quantity', value)
onValueChange: (value) => {
props.changeFn(props.idx, 'quantity', value);
serialNumberGenerator.update({ quantity: value });
}
}}
error={props.rowErrors?.quantity?.message}
/>