From 1956028ddcd3a2020bf3d19c9fb5db4bc6f32788 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 14 Jul 2015 10:26:50 +0530 Subject: [PATCH] [fix] supplier invoice number fix --- .../accounts/doctype/purchase_invoice/purchase_invoice.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index af144cbf40..1ac0f5acd8 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -126,7 +126,7 @@ class PurchaseInvoice(BuyingController): if cint(frappe.db.get_single_value('Buying Settings', 'maintain_same_rate')): self.validate_rate_with_reference_doc([ - ["Purchase Order", "purchase_order", "po_detail"], + ["Purchase Order", "purchase_order", "po_detail"], ["Purchase Receipt", "purchase_receipt", "pr_detail"] ]) @@ -382,7 +382,8 @@ class PurchaseInvoice(BuyingController): frappe.throw("Supplier Invoice Date cannot be greater than Posting Date") if self.bill_no: if cint(frappe.db.get_single_value("Accounts Settings", "check_supplier_invoice_uniqueness")): - pi = frappe.db.exists("Purchase Invoice", {"bill_no": self.bill_no, "fiscal_year": self.fiscal_year}) + pi = frappe.db.exists("Purchase Invoice", {"bill_no": self.bill_no, + "fiscal_year": self.fiscal_year, "name": ("!=", self.name)}) if pi: frappe.throw("Supplier Invoice No exists in Purchase Invoice {0}".format(pi))