diff --git a/erpnext/patches/july_2012/auth_table.py b/erpnext/patches/july_2012/auth_table.py new file mode 100644 index 00000000000..db087414415 --- /dev/null +++ b/erpnext/patches/july_2012/auth_table.py @@ -0,0 +1,12 @@ +import webnotes +def execute(): + webnotes.conn.commit() + + from webnotes.install_lib.install import Installer + Installer(None, None).create_auth_table() + + webnotes.conn.begin() + + for user, password in webnotes.conn.sql("""select name, password from tabProfile"""): + webnotes.conn.sql("""insert into __Auth (user, `password`) values (%s, %s)""", + (user, password)) diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 32e1a6ef6e5..2392fd5a652 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -496,4 +496,8 @@ patch_list = [ 'patch_file': 'cms2', 'description': 'cms2 release patches' }, + { 'patch_module': 'patches.july_2012', + 'patch_file': 'auth_table', + 'description': 'create new __Auth table' + }, ] \ No newline at end of file diff --git a/erpnext/selling/doctype/sales_order/listview.js b/erpnext/selling/doctype/sales_order/listview.js index cbe35daae1d..3fa63a5d7f8 100644 --- a/erpnext/selling/doctype/sales_order/listview.js +++ b/erpnext/selling/doctype/sales_order/listview.js @@ -3,21 +3,23 @@ wn.doclistviews['Sales Order'] = wn.views.ListView.extend({ init: function(d) { this._super(d) this.fields = this.fields.concat([ - "`tabSales Order`.customer_name", + "`tabSales Order`.customer_name", + "`tabSales Order`.status", + "`tabSales Order`.order_type", "ifnull(`tabSales Order`.per_delivered,0) as per_delivered", "ifnull(`tabSales Order`.per_billed,0) as per_billed", "`tabSales Order`.currency", "ifnull(`tabSales Order`.grand_total_export,0) as grand_total_export" ]); - this.stats = this.stats.concat(['status', 'company']); + this.stats = this.stats.concat(['status', 'order_type', 'company']); }, columns: [ {width: '3%', content: 'check'}, - {width: '5%', content:'avatar'}, - {width: '3%', content:'docstatus'}, - {width: '15%', content:'name'}, - {width: '32%', content:'customer_name+tags', css: {color:'#222'}}, + {width: '5%', content: 'avatar'}, + {width: '3%', content: 'docstatus'}, + {width: '15%', content: 'name'}, + {width: '29%', content: 'customer_name+tags', css: {color:'#222'}}, { width: '18%', content: function(parent, data) { @@ -25,7 +27,19 @@ wn.doclistviews['Sales Order'] = wn.views.ListView.extend({ }, css: {'text-align':'right'} }, - {width: '8%', content: 'per_delivered', type:'bar-graph', label:'Delivered'}, + { + width: '11%', + content: function(parent, data, me) { + var order_type = data.order_type.toLowerCase(); + + if (order_type === 'sales') { + me.render_icon(parent, 'icon-tag', data.order_type); + me.render_bar_graph(parent, data, 'per_billed', 'Delivered'); + } else if (order_type === 'maintenance') { + me.render_icon(parent, 'icon-wrench', data.order_type); + } + }, + }, {width: '8%', content: 'per_billed', type:'bar-graph', label:'Billed'}, {width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}} ] diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index 0c5eae18921..d05b2ec8d33 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -40,8 +40,9 @@ def on_login_post_session(login_manager): if webnotes.session['user'] not in ('Guest', 'demo@webnotestech.com'): # create feed from webnotes.utils import nowtime + from webnotes.profile import get_user_fullname home.make_feed('Login', 'Profile', login_manager.user, login_manager.user, - '%s logged in at %s' % (login_manager.user_fullname, nowtime()), + '%s logged in at %s' % (get_user_fullname, nowtime()), login_manager.user=='Administrator' and '#8CA2B3' or '#1B750D') diff --git a/erpnext/utilities/page/users/users.py b/erpnext/utilities/page/users/users.py index 07504a80779..336282bace2 100644 --- a/erpnext/utilities/page/users/users.py +++ b/erpnext/utilities/page/users/users.py @@ -30,9 +30,13 @@ def get(arg=None): @webnotes.whitelist() def get_roles(arg=None): - """return all roles""" + """return all roles except standard""" + return _get_roles(webnotes.form_dict['uid']) + +def _get_roles(user): + """return all roles except standard""" return [r[0] for r in webnotes.conn.sql("""select name from tabRole - where name not in ('Administrator', 'Guest', 'All') order by name""")] + where name not in ('Administrator', 'Guest', 'All') order by name""", user)] @webnotes.whitelist() def get_user_roles(arg=None): diff --git a/erpnext/website/templates/js/login.js b/erpnext/website/templates/js/login.js index 29e49226fcc..4ca18c94527 100644 --- a/erpnext/website/templates/js/login.js +++ b/erpnext/website/templates/js/login.js @@ -59,6 +59,7 @@ erpnext.login.doLogin = function(){ args['remember_me'] = 1; $('#login_btn').set_working(); + $('#login_message').empty(); $c("login", args, erpnext.login.onLoginReply); diff --git a/public/js/all-app.js b/public/js/all-app.js index ef3b4e38e4d..2024c31b551 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -678,7 +678,8 @@ this.set_input(_f.get_value(this.doctype,this.docname,this.df.fieldname));this.r Field.prototype.refresh_label_icon=function(){if(this.df.reqd){if(this.get_value&&is_null(this.get_value())){if(this.label_icon)$ds(this.label_icon);$(this.txt?this.txt:this.input).addClass('field-to-update')}else{if(this.label_icon)$dh(this.label_icon);$(this.txt?this.txt:this.input).removeClass('field-to-update')}}} Field.prototype.set=function(val){if(this.not_in_form) return;if((!this.docname)&&this.grid){this.docname=this.grid.add_newrow();} -var set_val=val;if(this.validate)set_val=this.validate(val);_f.set_value(this.doctype,this.docname,this.df.fieldname,set_val);this.value=val;} +if(this.validate) +val=this.validate(val);cur_frm.set_value_in_locals(this.doctype,this.docname,this.df.fieldname,val);this.value=val;} Field.prototype.set_input=function(val){this.value=val;if(this.input&&this.input.set_input){if(val==null)this.input.set_input('');else this.input.set_input(val);} var disp_val=val;if(val==null)disp_val='';this.set_disp(disp_val);} Field.prototype.run_trigger=function(){this.refresh_label_icon();if(this.df.reqd&&this.get_value&&!is_null(this.get_value())&&this.set_as_error) @@ -713,9 +714,9 @@ return v;}else{return v;}} DataField.prototype.onrefresh=function(){if(this.input&&this.df.colour){var col='#'+this.df.colour.split(':')[1];$bg(this.input,col);}} function ReadOnlyField(){} ReadOnlyField.prototype=new Field();function HTMLField(){} -HTMLField.prototype=new Field();HTMLField.prototype.with_label=0;HTMLField.prototype.set_disp=function(val){this.disp_area.innerHTML=val;} +HTMLField.prototype=new Field();HTMLField.prototype.with_label=0;HTMLField.prototype.set_disp=function(val){if(this.disp_area)this.disp_area.innerHTML=val;} HTMLField.prototype.set_input=function(val){if(val)this.set_disp(val);} -HTMLField.prototype.onrefresh=function(){this.set_disp(this.df.options?this.df.options:'');} +HTMLField.prototype.onrefresh=function(){if(this.df.options)this.set_disp(this.df.options);} var datepicker_active=0;function DateField(){}DateField.prototype=new Field();DateField.prototype.make_input=function(){var me=this;this.user_fmt=wn.control_panel.date_format;if(!this.user_fmt)this.user_fmt='dd-mm-yy';this.input=$a(this.input_area,'input');$(this.input).datepicker({dateFormat:me.user_fmt.replace('yyyy','yy'),altFormat:'yy-mm-dd',changeYear:true,beforeShow:function(input,inst){datepicker_active=1},onClose:function(dateText,inst){datepicker_active=0;if(_f.cur_grid_cell) _f.cur_grid_cell.grid.cell_deselect();}});var me=this;me.input.onchange=function(){if(this.value==null)this.value='';if(!this.not_in_form) me.set(dateutil.user_to_str(me.input.value));me.run_trigger();} @@ -998,7 +999,7 @@ args.label=v[0];args.width=flt(v[1])/max*100;args.count=v[1];args.field=field;$i ',args));this.setup_stat_item_click($item);return $item;},reload_stats:function(){this.$page.find('.layout-side-section .stat-wrapper').remove();this.init_stats();},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}} this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];this.show_hide_check_column();},columns:[{width:'3%',content:'check'},{width:'4%',content:'avatar'},{width:'3%',content:'docstatus',css:{"text-align":"center"}},{width:'35%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'15%',content:'modified',css:{'text-align':'right','color':'#222'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});} if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;} -if(typeof opts.content=='function'){opts.content(parent,data);} +if(typeof opts.content=='function'){opts.content(parent,data,me);} else if(opts.content=='name'){$(parent).append(repl('%(name)s',data));} else if(opts.content=='avatar'){$(parent).append(repl('',data));} @@ -1007,12 +1008,7 @@ else if(opts.content=='docstatus'){$(parent).append(repl('',data));} else if(opts.content=='tags'){this.add_user_tags(parent,data);} else if(opts.content=='modified'){$(parent).append(data.when);} -else if(opts.type=='bar-graph'){args={percent:data[opts.content],fully_delivered:(data[opts.content]>99?'bar-complete':''),label:opts.label} -$(parent).append(repl('\ - \ - ',args));} +else if(opts.type=='bar-graph'){this.render_bar_graph(parent,data,opts.content,opts.label);} else if(opts.type=='link'&&opts.doctype){$(parent).append(repl(''+data[opts.content]+'',data));} else if(opts.template){$(parent).append(repl(opts.template,data));} @@ -1021,7 +1017,12 @@ for(key in data){if(data[key]==null){data[key]='';}}},prepare_when:function(data if(diff==1){data.when='Yesterday'} if(diff==2){data.when='2 days ago'}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){if($(parent).html().length>0){$(parent).append('
');} $.each(data._user_tags.split(','),function(i,t){if(t){$('' -+strip(t)+'').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}},show_hide_check_column:function(){if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}}});wn.provide('wn.views.RecordListView');wn.views.RecordListView=wn.views.DocListView.extend({init:function(doctype,wrapper,ListView){this.doctype=doctype;this.wrapper=wrapper;this.listview=new ListView(this);this.listview.parent=this;this.setup();},setup:function(){var me=this;me.page_length=10;$(me.wrapper).empty();me.init_list();},get_args:function(){var args=this._super();$.each((this.default_filters||[]),function(i,f){args.filters.push(f);});args.docstatus=args.docstatus.concat((this.default_docstatus||[]));return args;},}); ++strip(t)+'').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}},show_hide_check_column:function(){if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}},render_bar_graph:function(parent,data,field,label){var args={percent:data[field],fully_delivered:(data[field]>99?'bar-complete':''),label:label} +$(parent).append(repl('\ + \ + ',args));},render_icon:function(parent,icon_class,label){var icon_html="";$(parent).append(repl(icon_html,{icon_class:icon_class,label:label||''}));}});wn.provide('wn.views.RecordListView');wn.views.RecordListView=wn.views.DocListView.extend({init:function(doctype,wrapper,ListView){this.doctype=doctype;this.wrapper=wrapper;this.listview=new ListView(this);this.listview.parent=this;this.setup();},setup:function(){var me=this;me.page_length=10;$(me.wrapper).empty();me.init_list();},get_args:function(){var args=this._super();$.each((this.default_filters||[]),function(i,f){args.filters.push(f);});args.docstatus=args.docstatus.concat((this.default_docstatus||[]));return args;},}); /* * lib/js/wn/views/formview.js */ @@ -1359,7 +1360,7 @@ var getchildren=LocalDB.getchildren;var get_field=Meta.get_field;var createLocal /* * lib/js/legacy/model/doclist.js */ -function compress_doclist(list){var kl={};var vl=[];var flx={};for(var i=0;iCreated:
\ \ %(creation)s

\ diff --git a/public/js/all-web.js b/public/js/all-web.js index 91f52cb43c6..38221cde2c4 100644 --- a/public/js/all-web.js +++ b/public/js/all-web.js @@ -670,7 +670,7 @@ var getchildren=LocalDB.getchildren;var get_field=Meta.get_field;var createLocal /* * lib/js/legacy/model/doclist.js */ -function compress_doclist(list){var kl={};var vl=[];var flx={};for(var i=0;i