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:
parent
b2b1cd4fe0
commit
9d78473a2a
@ -102,12 +102,18 @@ export const SalesOrder = {
|
||||
url: (_id) =>
|
||||
`/dashboard/sales/salesorders/info?salesOrderId=${_id}&action=newInvoice`,
|
||||
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',
|
||||
label: 'Post',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user