mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
tree based changes
This commit is contained in:
@@ -2,7 +2,27 @@
|
|||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
cur_frm.cscript.refresh = function(doc) {
|
cur_frm.cscript.refresh = function(doc) {
|
||||||
cur_frm.set_intro(doc.__islocal ? "" : __("There is nothing to edit."))
|
cur_frm.set_intro(doc.__islocal ? "" : __("There is nothing to edit."));
|
||||||
|
cur_frm.cscript.set_root_readonly(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.set_root_readonly = function(doc) {
|
||||||
|
// read-only for root customer group
|
||||||
|
if(!doc.parent_supplier_group) {
|
||||||
|
cur_frm.set_read_only();
|
||||||
|
cur_frm.set_intro(__("This is a root supplier group and cannot be edited."));
|
||||||
|
} else {
|
||||||
|
cur_frm.set_intro(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//get query select Customer Group
|
||||||
|
cur_frm.fields_dict['parent_supplier_group'].get_query = function(doc,cdt,cdn) {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'is_group': 1
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(doc, cdt, cdn) {
|
||||||
|
|||||||
@@ -4,7 +4,17 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.utils.nestedset import NestedSet
|
||||||
|
|
||||||
class SupplierGroup(Document):
|
class SupplierGroup(NestedSet):
|
||||||
pass
|
nsm_parent_field = 'parent_supplier_group';
|
||||||
|
|
||||||
|
def update_nsm_model(self):
|
||||||
|
frappe.utils.nestedset.update_nsm(self)
|
||||||
|
|
||||||
|
def on_update(self):
|
||||||
|
self.update_nsm_model()
|
||||||
|
self.validate_one_root()
|
||||||
|
|
||||||
|
def on_trash(self):
|
||||||
|
self.update_nsm_model()
|
||||||
|
|||||||
Reference in New Issue
Block a user