Check for duplicate challan number only in submitted purchase receipts
This commit is contained in:
parent
0717ca63b2
commit
6afc6818a3
@ -93,11 +93,12 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
|
|
||||||
def validate_challan_no(self):
|
def validate_challan_no(self):
|
||||||
"Validate if same challan no exists for same supplier in a purchase receipt"
|
"Validate if same challan no exists for same supplier in a submitted purchase receipt"
|
||||||
if self.doc.challan_no:
|
if self.doc.challan_no:
|
||||||
exists = webnotes.conn.sql("""
|
exists = webnotes.conn.sql("""
|
||||||
SELECT name FROM `tabPurchase Receipt`
|
SELECT name FROM `tabPurchase Receipt`
|
||||||
WHERE name!=%s AND supplier=%s AND challan_no=%s""", (self.doc.name, self.doc.supplier, self.doc.challan_no))
|
WHERE name!=%s AND supplier=%s AND challan_no=%s
|
||||||
|
AND docstatus=1""", (self.doc.name, self.doc.supplier, self.doc.challan_no))
|
||||||
if exists:
|
if exists:
|
||||||
webnotes.msgprint("Another Purchase Receipt using the same Challan No. already exists.\
|
webnotes.msgprint("Another Purchase Receipt using the same Challan No. already exists.\
|
||||||
Please enter a valid Challan No.", raise_exception=1)
|
Please enter a valid Challan No.", raise_exception=1)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user