mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-13 07:18:27 +00:00
fix: added error handling if entry already exists
This commit is contained in:
@@ -3,8 +3,16 @@
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
# import frappe
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
|
||||
class SupplierItemGroup(Document):
|
||||
pass
|
||||
def validate(self):
|
||||
exists = frappe.db.exists({
|
||||
'doctype': 'Supplier Item Group',
|
||||
'supplier': self.supplier,
|
||||
'item_group': self.item_group
|
||||
})
|
||||
if exists:
|
||||
frappe.throw(_("Item Group has already been linked to this supplier."))
|
||||
Reference in New Issue
Block a user