fix: added error handling if entry already exists
This commit is contained in:
parent
8e34c49ac9
commit
bf7f0530e6
@ -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."))
|
Loading…
x
Reference in New Issue
Block a user