Hi im new to erpnext
im testing the customization on erpnext
i noticed that when using/selecting Unique on Custom Field and Custom Form
it includes/considers Cancelled Documents,
Is Amending with Unique values not possible?
Hi im new to erpnext
im testing the customization on erpnext
i noticed that when using/selecting Unique on Custom Field and Custom Form
it includes/considers Cancelled Documents,
Is Amending with Unique values not possible?
@claily welcome to the forum.
Since this is a database level constraint, it will consider all documents.
Maybe it should be done programmatically.
I was able to do this by adding a script at journal_entry.py
def validate_cheque_duplicate(self):
if self.cheque_no:
duplicate = frappe.db.sql("""select cheque_no from `tabJournal Entry` where cheque_no = %s """, (self_cheque_no))
if duplicate:
frappe.throw(_("Cheque No {0} already used").format(self.cheque_no, duplicate[0][0]))
And Adding in def validate(self):
self.validate_cheque_duplicate()