[enhance] treeview to BOM, sales person, Cost Center and Chart of acounts
This commit is contained in:
parent
5f48cb6128
commit
0e47bfeb16
37
erpnext/accounts/doctype/account/account_treeview.js
Normal file
37
erpnext/accounts/doctype/account/account_treeview.js
Normal file
@ -0,0 +1,37 @@
|
||||
frappe.treeview_settings["Account"] = {
|
||||
breadcrumbs: "Accounts",
|
||||
title: __("Chart Of Accounts"),
|
||||
get_tree_root: false,
|
||||
filters: [{
|
||||
fieldname: "comp",
|
||||
fieldtype:"Select",
|
||||
options: $.map(locals[':Company'], function(c) { return c.name; }).sort(),
|
||||
label: __("Company")
|
||||
}],
|
||||
root_label: "Accounts",
|
||||
get_tree_nodes: 'erpnext.accounts.page.accounts_browser.accounts_browser.get_children',
|
||||
add_tree_node: 'erpnext.accounts.utils.add_ac',
|
||||
menu_items:[
|
||||
{
|
||||
label: __('New Company'),
|
||||
action: function() { newdoc('Company'); },
|
||||
condition: 'frappe.boot.user.can_create.indexOf("Company") === -1'
|
||||
}
|
||||
],
|
||||
fields: [
|
||||
{fieldtype:'Data', fieldname:'account_name', label:__('New Account Name'), reqd:true,
|
||||
description: __("Name of new Account. Note: Please don't create accounts for Customers and Suppliers")},
|
||||
{fieldtype:'Check', fieldname:'is_group', label:__('Is Group'),
|
||||
description: __('Further accounts can be made under Groups, but entries can be made against non-Groups')},
|
||||
{fieldtype:'Select', fieldname:'root_type', label:__('Root Type'),
|
||||
options: ['Asset', 'Liability', 'Equity', 'Income', 'Expense'].join('\n'),
|
||||
},
|
||||
{fieldtype:'Select', fieldname:'account_type', label:__('Account Type'),
|
||||
options: ['', 'Bank', 'Cash', 'Warehouse', 'Tax', 'Chargeable'].join('\n'),
|
||||
description: __("Optional. This setting will be used to filter in various transactions.") },
|
||||
{fieldtype:'Float', fieldname:'tax_rate', label:__('Tax Rate')},
|
||||
{fieldtype:'Link', fieldname:'warehouse', label:__('Warehouse'), options:"Warehouse"},
|
||||
{fieldtype:'Link', fieldname:'account_currency', label:__('Currency'), options:"Currency",
|
||||
description: __("Optional. Sets company's default currency, if not specified.")}
|
||||
]
|
||||
}
|
25
erpnext/accounts/doctype/cost_center/cost_center_treeview.js
Normal file
25
erpnext/accounts/doctype/cost_center/cost_center_treeview.js
Normal file
@ -0,0 +1,25 @@
|
||||
frappe.treeview_settings["Cost Center"] = {
|
||||
breadcrumbs: "Accounts",
|
||||
get_tree_root: false,
|
||||
filters: [{
|
||||
fieldname: "comp",
|
||||
fieldtype:"Select",
|
||||
options: $.map(locals[':Company'], function(c) { return c.name; }).sort(),
|
||||
label: __("Company"),
|
||||
}],
|
||||
root_label: "Cost Centers",
|
||||
get_tree_nodes: 'erpnext.accounts.page.accounts_browser.accounts_browser.get_children',
|
||||
add_tree_node: 'erpnext.accounts.utils.add_cc',
|
||||
menu_items:[
|
||||
{
|
||||
label: __('New Company'),
|
||||
action: function() { newdoc('Company'); },
|
||||
condition: 'frappe.boot.user.can_create.indexOf("Company") === -1'
|
||||
}
|
||||
],
|
||||
fields:[
|
||||
{fieldtype:'Data', fieldname:'cost_center_name', label:__('New Cost Center Name'), reqd:true},
|
||||
{fieldtype:'Check', fieldname:'is_group', label:__('Is Group'),
|
||||
description:__('Further cost centers can be made under Groups but entries can be made against non-Groups')}
|
||||
]
|
||||
}
|
@ -135,6 +135,10 @@ def add_ac(args=None):
|
||||
args.pop("ignore_permissions")
|
||||
|
||||
ac.update(args)
|
||||
|
||||
if not ac.parent_account:
|
||||
ac.parent_account = args.get("parent")
|
||||
|
||||
ac.old_parent = ""
|
||||
ac.freeze_account = "No"
|
||||
if cint(ac.get("is_root")):
|
||||
@ -153,6 +157,10 @@ def add_cc(args=None):
|
||||
|
||||
cc = frappe.new_doc("Cost Center")
|
||||
cc.update(args)
|
||||
|
||||
if not cc.parent_cost_center:
|
||||
cc.parent_cost_center = args.get("parent")
|
||||
|
||||
cc.old_parent = ""
|
||||
cc.insert()
|
||||
return cc.name
|
||||
|
@ -8,9 +8,10 @@ frappe.treeview_settings["BOM"] = {
|
||||
label: __("BOM")
|
||||
}
|
||||
],
|
||||
title: "BOM",
|
||||
breadcrumb: "Manufacturing",
|
||||
disable_add_node: true,
|
||||
label: "bom", // should be fieldname from filters
|
||||
root_label: "bom", //fieldname from filters
|
||||
get_label: function(node) {
|
||||
if(node.data.qty) {
|
||||
return node.data.qty + " x " + node.data.item_code;
|
||||
|
11
erpnext/setup/doctype/sales_person/sales_person_treeview.js
Normal file
11
erpnext/setup/doctype/sales_person/sales_person_treeview.js
Normal file
@ -0,0 +1,11 @@
|
||||
frappe.treeview_settings["Sales Person"] = {
|
||||
fields: [
|
||||
{fieldtype:'Data', fieldname: 'name_field',
|
||||
label:__('New Sales Person Name'), reqd:true},
|
||||
{fieldtype:'Link', fieldname:'employee',
|
||||
label:__('Employee'), options:'Employee',
|
||||
description: __("Please enter Employee Id of this sales person")},
|
||||
{fieldtype:'Select', fieldname:'is_group', label:__('Group Node'), options:'No\nYes',
|
||||
description: __("Further nodes can be only created under 'Group' type nodes")}
|
||||
],
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user