From f7414519bb5eff5581a3146285e58aab77874f9c Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 16 May 2018 13:57:16 +0530 Subject: [PATCH] [fix] set default supplier group in test --- erpnext/setup/doctype/supplier_group/supplier_group.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/supplier_group/supplier_group.py b/erpnext/setup/doctype/supplier_group/supplier_group.py index 747560a533..fa265d4d99 100644 --- a/erpnext/setup/doctype/supplier_group/supplier_group.py +++ b/erpnext/setup/doctype/supplier_group/supplier_group.py @@ -4,10 +4,13 @@ from __future__ import unicode_literals import frappe -from frappe.utils.nestedset import NestedSet +from frappe.utils.nestedset import NestedSet, get_root_of class SupplierGroup(NestedSet): nsm_parent_field = 'parent_supplier_group'; + def validate(self): + if not self.parent_supplier_group: + self.parent_supplier_group = get_root_of("Supplier Group") def update_nsm_model(self): frappe.utils.nestedset.update_nsm(self)