fix: mandatory error

(cherry picked from commit 4c70b1a06bff81aac6baacffe34d624c7e3c4b86)
This commit is contained in:
Shariq Ansari 2025-07-01 15:06:02 +05:30 committed by Mergify
parent 47002deed6
commit 08243530e7
3 changed files with 12 additions and 3 deletions

View File

@ -121,7 +121,10 @@ const callBacks = {
loading.value = false
if (err.exc_type == 'MandatoryError') {
const errorMessage = err.messages
.map((msg) => msg.split(': ')[2].trim())
.map((msg) => {
let arr = msg.split(': ')
return arr[arr.length - 1].trim()
})
.join(', ')
error.value = __('These fields are required: {0}', [errorMessage])
return

View File

@ -124,7 +124,10 @@ const callBacks = {
loading.value = false
if (err.exc_type == 'MandatoryError') {
const errorMessage = err.messages
.map((msg) => msg.split(': ')[2].trim())
.map((msg) => {
let arr = msg.split(': ')
return arr[arr.length - 1].trim()
})
.join(', ')
error.value = __('These fields are required: {0}', [errorMessage])
return

View File

@ -26,7 +26,10 @@ export function useDocument(doctype, docname) {
let errorMessage = __('Error updating document')
if (err.exc_type == 'MandatoryError') {
const fieldName = err.messages
.map((msg) => msg.split(': ')[2].trim())
.map((msg) => {
let arr = msg.split(': ')
return arr[arr.length - 1].trim()
})
.join(', ')
errorMessage = __('Mandatory field error: {0}', [fieldName])
}