Update SalesOrder model to refine state validation for invoice actions

- Enhanced the disabled logic for invoice actions by introducing a list of allowed states: 'delivered', 'sent', 'confirmed', 'shipped', 'partiallyDelivered', and 'partiallyShipped'.
- Simplified the return statement for better readability and maintainability.
This commit is contained in:
Tom Butcher 2025-12-28 02:10:40 +00:00
parent b2b1cd4fe0
commit 9d78473a2a

View File

@ -102,12 +102,18 @@ export const SalesOrder = {
url: (_id) => url: (_id) =>
`/dashboard/sales/salesorders/info?salesOrderId=${_id}&action=newInvoice`, `/dashboard/sales/salesorders/info?salesOrderId=${_id}&action=newInvoice`,
disabled: (objectData) => { disabled: (objectData) => {
return objectData?.state?.type != 'delivered' const allowedStates = [
'delivered',
'sent',
'confirmed',
'shipped',
'partiallyDelivered',
'partiallyShipped'
]
return !allowedStates.includes(objectData?.state?.type)
} }
}, },
{ { type: 'divider' },
type: 'divider'
},
{ {
name: 'post', name: 'post',
label: 'Post', label: 'Post',