fix: added error handling if entry already exists

This commit is contained in:
noahjacob 2021-05-19 13:53:22 +05:30
parent 8e34c49ac9
commit bf7f0530e6

View File

@ -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."))