From 768a888bf2f25dfd752bd2d523f5eb1b641c7a2c Mon Sep 17 00:00:00 2001 From: joezsweet Date: Tue, 11 Apr 2017 09:31:45 +0200 Subject: [PATCH] [fix] validate supplier invoice - modified to check for the selected supplier only --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 1972cc9da91..4d58f987ca6 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -628,10 +628,12 @@ class PurchaseInvoice(BuyingController): pi = frappe.db.sql('''select name from `tabPurchase Invoice` where bill_no = %(bill_no)s + and supplier = %(supplier)s and name != %(name)s and docstatus < 2 and posting_date between %(year_start_date)s and %(year_end_date)s''', { "bill_no": self.bill_no, + "supplier": self.supplier, "name": self.name, "year_start_date": fiscal_year.year_start_date, "year_end_date": fiscal_year.year_end_date