Merge branch 'shf_rename' of github.com:webnotes/erpnext into shf_rename
This commit is contained in:
commit
44f16eaefa
@ -1945,7 +1945,7 @@ div.std-footer-item {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.layout-section {
|
||||
.layout-main {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
|
@ -1425,7 +1425,7 @@ div.std-footer-item {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.layout-section {
|
||||
.layout-main {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ select.accbrowser-company-select {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
span.accbrowser-node-toolbar {
|
||||
span.tree-node-toolbar {
|
||||
padding: 2px;
|
||||
margin-left: 15px;
|
||||
border-radius: 3px;
|
||||
|
@ -102,7 +102,7 @@ erpnext.AccountsChart = Class.extend({
|
||||
var data = $(link).data('node-data');
|
||||
if(!data) return;
|
||||
|
||||
link.toolbar = $('<span class="accbrowser-node-toolbar"></span>').insertAfter(link);
|
||||
link.toolbar = $('<span class="tree-node-toolbar"></span>').insertAfter(link);
|
||||
|
||||
// edit
|
||||
$('<a href="#!Form/'+encodeURIComponent(this.ctype)+'/'
|
||||
@ -112,7 +112,7 @@ erpnext.AccountsChart = Class.extend({
|
||||
link.toolbar.append(' | <a onclick="erpnext.account_chart.new_node();">Add Child</a>');
|
||||
} else if(this.ctype=='Account') {
|
||||
link.toolbar.append(' | <a onclick="erpnext.account_chart.show_ledger();">View Ledger</a>');
|
||||
}
|
||||
}
|
||||
},
|
||||
show_ledger: function() {
|
||||
var me = this;
|
||||
|
@ -1,6 +1,7 @@
|
||||
<div class="layout-wrapper">
|
||||
<a class="close" onclick="window.history.back();">×</a>
|
||||
<h1>Activity</h1>
|
||||
<div id="activity-list">
|
||||
<div class="layout-wrapper layout-wrapper-appframe">
|
||||
<div class="layout-appframe"></div>
|
||||
<div class="layout-main">
|
||||
<div id="activity-list">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,5 +1,8 @@
|
||||
wn.pages['activity'].onload = function(wrapper) {
|
||||
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe'));
|
||||
wrapper.appframe.title('Activity');
|
||||
var list = new wn.ui.Listing({
|
||||
appframe: wrapper.appframe,
|
||||
method: 'home.page.activity.activity.get_feed',
|
||||
parent: $('#activity-list'),
|
||||
render_row: function(row, data) {
|
||||
|
14
erpnext/selling/page/sales_browser/sales_browser.css
Normal file
14
erpnext/selling/page/sales_browser/sales_browser.css
Normal file
@ -0,0 +1,14 @@
|
||||
span.tree-node-toolbar {
|
||||
padding: 2px;
|
||||
margin-left: 15px;
|
||||
border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
.tree-area a.selected {
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
}
|
@ -1,4 +1,11 @@
|
||||
<div class="layout_wrapper">
|
||||
<div id="tr_header"></div>
|
||||
<div id="tr_body" style="margin: 16px"></div>
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
<div class="appframe-area"></div>
|
||||
<div class="layout-main-section">
|
||||
<div class="tree-area"></div>
|
||||
</div>
|
||||
<div class="layout-side-section">
|
||||
<div class="help">To add child nodes, explore tree and click on the node under which you want to add more nodes.
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
@ -14,6 +14,123 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
pscript['onload_Sales Browser'] = function(wrapper){
|
||||
wn.require('lib/js/wn/ui/tree.js');
|
||||
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
|
||||
wrapper.appframe.add_button('Refresh', function() {
|
||||
wrapper.make_tree();
|
||||
}, 'icon-refresh');
|
||||
|
||||
wrapper.make_tree = function() {
|
||||
var ctype = wn.get_route()[1] || 'Territory';
|
||||
erpnext.sales_chart = new erpnext.SalesChart(ctype, wrapper);
|
||||
}
|
||||
|
||||
wrapper.make_tree();
|
||||
}
|
||||
|
||||
pscript['onshow_Sales Browser'] = function(wrapper){
|
||||
// set route
|
||||
var ctype = wn.get_route()[1] || 'Territory';
|
||||
wrapper.appframe.title(ctype + ' Tree');
|
||||
|
||||
if(erpnext.sales_chart && erpnext.sales_chart.ctype != ctype) {
|
||||
wrapper.make_tree();
|
||||
}
|
||||
};
|
||||
|
||||
erpnext.SalesChart = Class.extend({
|
||||
init: function(ctype, wrapper) {
|
||||
var root_nodes = {
|
||||
'Territory': 'All Territories',
|
||||
'Item Group': 'All Item Groups',
|
||||
'Customer Group': 'All Customer Groups',
|
||||
'Sales Person': 'All Sales Persons'
|
||||
}
|
||||
|
||||
$(wrapper).find('.tree-area').empty();
|
||||
var me = this;
|
||||
me.ctype = ctype;
|
||||
this.tree = new wn.ui.Tree({
|
||||
parent: $(wrapper).find('.tree-area'),
|
||||
label: root_nodes[ctype],
|
||||
args: {ctype: ctype},
|
||||
method: 'selling.page.sales_browser.sales_browser.get_children',
|
||||
click: function(link) {
|
||||
if(me.cur_toolbar)
|
||||
$(me.cur_toolbar).toggle(false);
|
||||
|
||||
if(!link.toolbar)
|
||||
me.make_link_toolbar(link);
|
||||
|
||||
if(link.toolbar) {
|
||||
me.cur_toolbar = link.toolbar;
|
||||
$(me.cur_toolbar).toggle(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.tree.rootnode.$a
|
||||
.data('node-data', {value: root_nodes[ctype], expandable:1})
|
||||
.click();
|
||||
},
|
||||
make_link_toolbar: function(link) {
|
||||
var data = $(link).data('node-data');
|
||||
if(!data) return;
|
||||
|
||||
link.toolbar = $('<span class="tree-node-toolbar"></span>').insertAfter(link);
|
||||
|
||||
// edit
|
||||
$('<a href="#!Form/'+encodeURIComponent(this.ctype)+'/'
|
||||
+encodeURIComponent(data.value)+'">Edit</a>').appendTo(link.toolbar);
|
||||
|
||||
if(data.expandable) {
|
||||
link.toolbar.append(' | <a onclick="erpnext.sales_chart.new_node();">Add Child</a>');
|
||||
}
|
||||
},
|
||||
new_node: function() {
|
||||
var me = this;
|
||||
|
||||
// the dialog
|
||||
var d = new wn.ui.Dialog({
|
||||
title:'New ' + me.ctype,
|
||||
fields: [
|
||||
{fieldtype:'Data', fieldname: 'name_field', label:'New ' + me.ctype + ' Name', reqd:true},
|
||||
{fieldtype:'Select', fieldname:'is_group', label:'Group Node',
|
||||
options:'No\nYes', description:'Entries can made only against non-group (leaf) nodes'},
|
||||
{fieldtype:'Button', fieldname:'create_new', label:'Create New' }
|
||||
]
|
||||
})
|
||||
|
||||
// create
|
||||
$(d.fields_dict.create_new.input).click(function() {
|
||||
var btn = this;
|
||||
$(btn).set_working();
|
||||
var v = d.get_values();
|
||||
if(!v) return;
|
||||
|
||||
var node = me.selected_node();
|
||||
|
||||
v.parent = node.data('label');
|
||||
v.ctype = me.ctype;
|
||||
|
||||
wn.call({
|
||||
method: 'selling.page.sales_browser.sales_browser.add_node',
|
||||
args: v,
|
||||
callback: function() {
|
||||
$(btn).done_working();
|
||||
d.hide();
|
||||
node.trigger('reload');
|
||||
}
|
||||
})
|
||||
});
|
||||
d.show();
|
||||
},
|
||||
selected_node: function() {
|
||||
return this.tree.$w.find('.tree-link.selected');
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
pscript['onshow_Sales Browser'] = function(){
|
||||
wn.require('lib/js/legacy/widgets/tree.js');
|
||||
|
||||
@ -397,14 +514,14 @@ MakeDialog.prototype.btn_onclick=function(btn_name){
|
||||
$c_obj('Sales Browser Control',method_name, docstring(arg2), function(r,rt) {
|
||||
me.main_dialog.widgets[me.lbl_rec].value='';
|
||||
me.main_dialog.hide();
|
||||
/*if(me.btn_name == "Create"){
|
||||
me.cls_obj.cur_node.clear_child_nodes();
|
||||
me.cls_obj.dtl.innerHTML = '';
|
||||
me.cls_obj.cur_node.expand();
|
||||
}
|
||||
else{
|
||||
me.cls_obj.refresh_tree();
|
||||
}*/
|
||||
//if(me.btn_name == "Create"){
|
||||
// me.cls_obj.cur_node.clear_child_nodes();
|
||||
// me.cls_obj.dtl.innerHTML = '';
|
||||
// me.cls_obj.cur_node.expand();
|
||||
//}
|
||||
//else{
|
||||
// me.cls_obj.refresh_tree();
|
||||
//}
|
||||
me.cls_obj.refresh_tree();
|
||||
});
|
||||
}
|
||||
@ -444,3 +561,4 @@ MakeDialog.prototype.make_args = function(){
|
||||
return {'node_title':nt,'sales_person_name':nm,'parent_sales_person':pnm,'is_group':grp,'old_parent':old_prt}
|
||||
|
||||
}
|
||||
*/
|
25
erpnext/selling/page/sales_browser/sales_browser.py
Normal file
25
erpnext/selling/page/sales_browser/sales_browser.py
Normal file
@ -0,0 +1,25 @@
|
||||
import webnotes
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_children():
|
||||
ctype = webnotes.form_dict.get('ctype')
|
||||
webnotes.form_dict['parent_field'] = 'parent_' + ctype.lower().replace(' ', '_')
|
||||
|
||||
return webnotes.conn.sql("""select name as value,
|
||||
if(is_group='Yes', 1, 0) as expandable
|
||||
from `tab%(ctype)s`
|
||||
where docstatus < 2
|
||||
and %(parent_field)s = "%(parent)s"
|
||||
order by name""" % webnotes.form_dict, as_dict=1)
|
||||
|
||||
@webnotes.whitelist()
|
||||
def add_node():
|
||||
from webnotes.model.doc import Document
|
||||
ctype = webnotes.form_dict.get('ctype')
|
||||
parent_field = 'parent_' + ctype.lower().replace(' ', '_')
|
||||
|
||||
d = Document(ctype)
|
||||
d.fields[ctype.lower().replace(' ', '_') + '_name'] = webnotes.form_dict['name_field']
|
||||
d.fields[parent_field] = webnotes.form_dict['parent']
|
||||
d.is_group = webnotes.form_dict['is_group']
|
||||
d.save()
|
@ -188,7 +188,7 @@ $(ele).css('-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')}
|
||||
/*
|
||||
* lib/js/wn/model.js
|
||||
*/
|
||||
wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],new_names:{},with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name);}});}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
|
||||
wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],new_names:{},with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name,r);}});}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
|
||||
/*
|
||||
* lib/js/wn/misc/tools.js
|
||||
*/
|
||||
@ -443,7 +443,7 @@ wn.views.make_404=function(){var page=wn.container.add_page('404');$(page).html(
|
||||
* lib/js/wn/views/formview.js
|
||||
*/
|
||||
wn.provide('wn.views.formview');wn.views.formview={show:function(dt,dn){if(wn.model.new_names[dn])
|
||||
dn=wn.model.new_names[dn];wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!(locals[dt]&&locals[dt][dn])){wn.container.change_to('404');return;}
|
||||
dn=wn.model.new_names[dn];wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn,r){if(r&&r['403'])return;if(!(locals[dt]&&locals[dt][dn])){wn.container.change_to('404');return;}
|
||||
if(!wn.views.formview[dt]){wn.views.formview[dt]=wn.container.add_page('Form - '+dt);wn.views.formview[dt].frm=new _f.Frm(dt,wn.views.formview[dt]);}
|
||||
wn.container.change_to('Form - '+dt);wn.views.formview[dt].frm.refresh(dn);});})},create:function(dt){var new_name=LocalDB.create(dt);wn.set_route('Form',dt,new_name);}}
|
||||
/*
|
||||
|
@ -75,7 +75,7 @@ $(ele).css('-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')}
|
||||
/*
|
||||
* lib/js/wn/model.js
|
||||
*/
|
||||
wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],new_names:{},with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name);}});}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
|
||||
wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],new_names:{},with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name,r);}});}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
|
||||
/*
|
||||
* lib/js/wn/misc/tools.js
|
||||
*/
|
||||
@ -330,7 +330,7 @@ wn.views.make_404=function(){var page=wn.container.add_page('404');$(page).html(
|
||||
* lib/js/wn/views/formview.js
|
||||
*/
|
||||
wn.provide('wn.views.formview');wn.views.formview={show:function(dt,dn){if(wn.model.new_names[dn])
|
||||
dn=wn.model.new_names[dn];wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!(locals[dt]&&locals[dt][dn])){wn.container.change_to('404');return;}
|
||||
dn=wn.model.new_names[dn];wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn,r){if(r&&r['403'])return;if(!(locals[dt]&&locals[dt][dn])){wn.container.change_to('404');return;}
|
||||
if(!wn.views.formview[dt]){wn.views.formview[dt]=wn.container.add_page('Form - '+dt);wn.views.formview[dt].frm=new _f.Frm(dt,wn.views.formview[dt]);}
|
||||
wn.container.change_to('Form - '+dt);wn.views.formview[dt].frm.refresh(dn);});})},create:function(dt){var new_name=LocalDB.create(dt);wn.set_route('Form',dt,new_name);}}
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user