new favicon
diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py
index bef4987..3b820b8 100644
--- a/erpnext/setup/doctype/naming_series/naming_series.py
+++ b/erpnext/setup/doctype/naming_series/naming_series.py
@@ -19,6 +19,7 @@
from webnotes.utils import cint, cstr
from webnotes import msgprint, errprint
+import webnotes.model.doctype
sql = webnotes.conn.sql
@@ -31,13 +32,13 @@
#-----------------------------------------------------------------------------------------------------------------------------------
def get_transactions(self):
- return "\n".join([''] + [i[0] for i in sql("SELECT `tabDocField`.`parent` FROM `tabDocField`, `tabDocType` WHERE `tabDocField`.`fieldname` = 'naming_series' and `tabDocType`.module !='Recycle Bin' and `tabDocType`.name=`tabDocField`.parent order by `tabDocField`.parent")])
+ return "\n".join([''] + [i[0] for i in sql("SELECT `tabDocField`.`parent` FROM `tabDocField`, `tabDocType` WHERE `tabDocField`.`fieldname` = 'naming_series' and `tabDocType`.name=`tabDocField`.parent order by `tabDocField`.parent")])
#-----------------------------------------------------------------------------------------------------------------------------------
def get_options_for(self, doctype):
- sr = sql("select options from `tabDocField` where parent='%s' and fieldname='naming_series'" % (doctype))
- if sr and sr[0][0]:
- return sr[0][0].split("\n")
+ sr = webnotes.model.doctype.get_property(doctype, 'naming_series')
+ if sr:
+ return sr.split("\n")
else:
return []
@@ -50,7 +51,7 @@
options = self.scrub_options_list(ol)
# validate names
- [self.validate_series_name(i) for i in options]
+ for i in options: self.validate_series_name(i)
if self.doc.user_must_always_select:
options = [''] + options
@@ -58,8 +59,28 @@
else:
default = options[0]
- # update
- sql("update tabDocField set `options`=%s, `default`=%s where parent=%s and fieldname='naming_series'", ("\n".join(options), default, doctype))
+ # update in property setter
+ prop_dict = {'options': "\n".join(options), 'default': default}
+ for prop in prop_dict:
+ ps_exists = webnotes.conn.sql("""SELECT name FROM `tabProperty Setter`
+ WHERE doc_type = %s AND field_name = 'naming_series'
+ AND property = %s""", (doctype, prop))
+ if ps_exists:
+ ps = Document('Property Setter', ps_exists[0][0])
+ ps.value = prop_dict[prop]
+ ps.save()
+ else:
+ ps = Document('Property Setter', fielddata = {
+ 'doctype_or_field': 'DocField',
+ 'doc_type': doctype,
+ 'field_name': 'naming_series',
+ 'property': prop,
+ 'value': prop_dict[prop],
+ 'property_type': 'Select',
+ 'select_doctype': doctype
+ })
+ ps.save(1)
+
self.doc.set_options = "\n".join(options)
#-----------------------------------------------------------------------------------------------------------------------------------
@@ -73,7 +94,8 @@
from core.doctype.doctype.doctype import DocType
dt = DocType()
- sr = sql("select options, parent from `tabDocField` where fieldname='naming_series' and parent != %s", self.doc.select_doc_for_series)
+ parent = sql("select parent from `tabDocField` where fieldname='naming_series' and parent != %s", self.doc.select_doc_for_series)
+ sr = ([p[0], webnotes.model.doctype.get_property(p[0], 'naming_series')] for p in parent)
options = self.scrub_options_list(self.doc.set_options.split("\n"))
for series in options:
dt.validate_series(series, self.doc.select_doc_for_series)
diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js
index 5d7e663..3a51a84 100644
--- a/erpnext/startup/startup.js
+++ b/erpnext/startup/startup.js
@@ -171,3 +171,4 @@
$(document).bind('startup', function() {
erpnext.startup.start();
});
+
diff --git a/favicon.ico b/favicon.ico
deleted file mode 100644
index 794eaaf..0000000
--- a/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/images/favicon.ico b/images/favicon.ico
new file mode 100644
index 0000000..045b1bd
--- /dev/null
+++ b/images/favicon.ico
Binary files differ
diff --git a/js/all-app.js b/js/all-app.js
index 75a130b..0d379fc 100644
--- a/js/all-app.js
+++ b/js/all-app.js
@@ -240,7 +240,7 @@
wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;default:wn.views.pageview.show(route[0]);}}
wn.get_route=function(route){if(!route)
route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return $.map(route.split('/'),function(r){return decodeURIComponent(r);});}
-wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;}
+wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;set_favicon();}
wn._cur_route=null;$(window).bind('hashchange',function(){if(location.hash==wn._cur_route)
return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}});
/*
@@ -2178,7 +2178,7 @@
user_defaults.hide_webnotes_toolbar=1;if(!cint(user_defaults.hide_webnotes_toolbar)||user=='Administrator'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}
$(document).trigger('startup');try{if(wn.control_panel.custom_startup_code)
eval(wn.control_panel.custom_startup_code);}catch(e){errprint(e);}
-var t=to_open();if(t){window.location.hash=t;}else if(home_page){loadpage(home_page);}
+var t=to_open();if(t){window.location.hash=t;set_favicon();}else if(home_page){loadpage(home_page);}
wn.route();$dh('startup_div');$ds('body_div');}
var callback=function(r,rt){if(r.exc)console.log(r.exc);setup_globals(r);setup_viewport();}
if(wn.boot){LocalDB.sync(wn.boot.docs);callback(wn.boot,'');if(wn.boot.error_messages)
@@ -2205,12 +2205,16 @@
function set_resize_observer(fn){if(resize_observers.indexOf(fn)==-1)resize_observers.push(fn);}
window.onresize=function(){return;var ht=get_window_height();for(var i=0;i<resize_observers.length;i++){resize_observers[i](ht);}}
get_window_height=function(){var ht=window.innerHeight?window.innerHeight:document.documentElement.offsetHeight?document.documentElement.offsetHeight:document.body.offsetHeight;return ht;}
+function set_favicon(){var link=$('link[type="image/x-icon"]').remove().attr("href");var favicon='\
+ <link rel="shortcut icon" href="'+link+'" type="image/x-icon"> \
+ <link rel="icon" href="'+link+'" type="image/x-icon">'
+$(favicon).appendTo('head');}
/*
* js/app.js
*/
wn.app={name:'ERPNext',license:'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',source:'https://github.com/webnotes/erpnext',publisher:'Web Notes Technologies Pvt Ltd, Mumbai',copyright:'© Web Notes Technologies Pvt Ltd',version:'2.'+window._version_number}
wn.modules_path='erpnext';wn.settings.no_history=true;$(document).bind('ready',function(){startup();});$(document).bind('toolbar_setup',function(){$('.brand').html('<b>erp</b>next\
- <i class="icon-home icon-white navbar-icon-home" ></i>').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});})
+ <i class="icon-home icon-white navbar-icon-home" ></i>').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});});
/*
* erpnext/startup/startup.js
*/
diff --git a/js/all-web.js b/js/all-web.js
index 58b748d..90f035e 100644
--- a/js/all-web.js
+++ b/js/all-web.js
@@ -154,7 +154,7 @@
wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;default:wn.views.pageview.show(route[0]);}}
wn.get_route=function(route){if(!route)
route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return $.map(route.split('/'),function(r){return decodeURIComponent(r);});}
-wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;}
+wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;set_favicon();}
wn._cur_route=null;$(window).bind('hashchange',function(){if(location.hash==wn._cur_route)
return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}});
/*
@@ -1206,7 +1206,7 @@
user_defaults.hide_webnotes_toolbar=1;if(!cint(user_defaults.hide_webnotes_toolbar)||user=='Administrator'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}
$(document).trigger('startup');try{if(wn.control_panel.custom_startup_code)
eval(wn.control_panel.custom_startup_code);}catch(e){errprint(e);}
-var t=to_open();if(t){window.location.hash=t;}else if(home_page){loadpage(home_page);}
+var t=to_open();if(t){window.location.hash=t;set_favicon();}else if(home_page){loadpage(home_page);}
wn.route();$dh('startup_div');$ds('body_div');}
var callback=function(r,rt){if(r.exc)console.log(r.exc);setup_globals(r);setup_viewport();}
if(wn.boot){LocalDB.sync(wn.boot.docs);callback(wn.boot,'');if(wn.boot.error_messages)
@@ -1233,12 +1233,16 @@
function set_resize_observer(fn){if(resize_observers.indexOf(fn)==-1)resize_observers.push(fn);}
window.onresize=function(){return;var ht=get_window_height();for(var i=0;i<resize_observers.length;i++){resize_observers[i](ht);}}
get_window_height=function(){var ht=window.innerHeight?window.innerHeight:document.documentElement.offsetHeight?document.documentElement.offsetHeight:document.body.offsetHeight;return ht;}
+function set_favicon(){var link=$('link[type="image/x-icon"]').remove().attr("href");var favicon='\
+ <link rel="shortcut icon" href="'+link+'" type="image/x-icon"> \
+ <link rel="icon" href="'+link+'" type="image/x-icon">'
+$(favicon).appendTo('head');}
/*
* js/app.js
*/
wn.app={name:'ERPNext',license:'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',source:'https://github.com/webnotes/erpnext',publisher:'Web Notes Technologies Pvt Ltd, Mumbai',copyright:'© Web Notes Technologies Pvt Ltd',version:'2.'+window._version_number}
wn.modules_path='erpnext';wn.settings.no_history=true;$(document).bind('ready',function(){startup();});$(document).bind('toolbar_setup',function(){$('.brand').html('<b>erp</b>next\
- <i class="icon-home icon-white navbar-icon-home" ></i>').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});})
+ <i class="icon-home icon-white navbar-icon-home" ></i>').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});});
/*
* erpnext/startup/startup.js
*/
diff --git a/js/app.js b/js/app.js
index f2e24bb..6555de0 100644
--- a/js/app.js
+++ b/js/app.js
@@ -38,4 +38,4 @@
}, function() {
$(this).find('.icon-home').removeClass('navbar-icon-home-hover');
});
-})
+});
diff --git a/version.num b/version.num
index f6e16be..ae6f116 100644
--- a/version.num
+++ b/version.num
@@ -1 +1 @@
-1496
\ No newline at end of file
+1507
\ No newline at end of file