Refactor SalesOrder and User Models for Improved Object Data Handling
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
- Updated the objectData method in SalesOrder and User models to directly return the complete objectData instead of a subset, enhancing data accessibility. - Improved clarity and maintainability of the objectData function structure in both models, ensuring consistent handling of order and user data.
This commit is contained in:
parent
8bb8d417f7
commit
749ddf0c31
@ -128,7 +128,7 @@ export const SalesOrder = {
|
||||
return objectData?.state?.type != 'draft'
|
||||
},
|
||||
objectData: (objectData) => ({
|
||||
order: { _id: objectData._id },
|
||||
order: objectData,
|
||||
orderType: 'salesOrder',
|
||||
syncAmount: 'itemPrice'
|
||||
})
|
||||
@ -142,10 +142,12 @@ export const SalesOrder = {
|
||||
disabled: (objectData) => {
|
||||
return objectData?.state?.type != 'draft'
|
||||
},
|
||||
objectData: (objectData) => ({
|
||||
objectData: (objectData) => {
|
||||
return {
|
||||
orderType: 'salesOrder',
|
||||
order: { _id: objectData._id }
|
||||
})
|
||||
order: objectData
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'newInvoice',
|
||||
|
||||
@ -74,7 +74,7 @@ export const User = {
|
||||
disabled: (objectData) => {
|
||||
return objectData?._user?._id != objectData?._id
|
||||
},
|
||||
objectData: (objectData) => ({ user: objectData })
|
||||
objectData: (objectData) => ({ user: objectData?._user || objectData })
|
||||
}
|
||||
],
|
||||
pages: [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user