Duplicate supplier delivery number validation in Purchase Receipt should happen per financial year

This commit is contained in:
Anand Doshi 2014-04-21 15:59:47 +05:30
parent 21ae930b4c
commit 0549b1c5c9

View File

@ -92,10 +92,9 @@ class PurchaseReceipt(BuyingController):
def validate_challan_no(self):
"Validate if same challan no exists for same supplier in a submitted purchase receipt"
if self.challan_no:
exists = frappe.db.sql_list("""
SELECT name FROM `tabPurchase Receipt`
WHERE name!=%s AND supplier=%s AND challan_no=%s
AND docstatus=1""", (self.name, self.supplier, self.challan_no))
exists = frappe.db.sql_list("""select name from `tabPurchase Receipt`
where docstatus=1 and name!=%s and supplier=%s and challan_no=%s
and fiscal_year=%s""", (self.name, self.supplier, self.challan_no, self.doc.fiscal_year))
if exists:
frappe.throw(_("Supplier delivery number duplicate in {0}").format(exists))