Unique error message Need Help

I have link field to Sales Invoice in my custom doctype which i set to unique. Now While i am in form if I select sales invoice twice system giving error like “Sales Invoice Number must be unique” but I Want like Sales Invoice SI-0324-22 Duplicated…" How to achive this? When I check the console in the error is showing “Duplicate entry ‘SI-0324-22’ for key ‘sales_invoice_number’”)). How to show this in message or change color of duplicate invoice entry

@NCP any help…

Hi @ErpnextRaja:

On duplicate values, framework throws a message like this
“Sales Invoice Number must be unique” (this comes from base_document.py)

To customize this behavior, maybe you can uncheck the “Unique” property and validate data with a custom function.

Hope this helps.

2 Likes

Hi @ErpnextRaja,

@avc is right; if you want to change the message or something else, then you have to add a custom function, or you can also apply the server script.

Please check the reference:

Thank You!

Thanks @avc @NCP