new favicon
This commit is contained in:
parent
9afb57ffb2
commit
859cb72606
@ -19,6 +19,7 @@ import webnotes
|
||||
|
||||
from webnotes.utils import cint, cstr
|
||||
from webnotes import msgprint, errprint
|
||||
import webnotes.model.doctype
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
@ -31,13 +32,13 @@ class DocType:
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
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 @@ class DocType:
|
||||
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 @@ class DocType:
|
||||
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 @@ class DocType:
|
||||
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)
|
||||
|
@ -171,3 +171,4 @@ erpnext.set_user_background = function(src) {
|
||||
$(document).bind('startup', function() {
|
||||
erpnext.startup.start();
|
||||
});
|
||||
|
||||
|
BIN
favicon.ico
BIN
favicon.ico
Binary file not shown.
Before Width: | Height: | Size: 318 B |
BIN
images/favicon.ico
Normal file
BIN
images/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -240,7 +240,7 @@ wn.route=function(){wn._cur_route=window.location.hash;route=wn.get_route();swit
|
||||
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 @@ var setup_viewport=function(){wn.container=new wn.views.Container();if(user=='Gu
|
||||
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 @@ var resize_observers=[]
|
||||
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
|
||||
*/
|
||||
|
@ -154,7 +154,7 @@ wn.route=function(){wn._cur_route=window.location.hash;route=wn.get_route();swit
|
||||
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 @@ var setup_viewport=function(){wn.container=new wn.views.Container();if(user=='Gu
|
||||
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 @@ var resize_observers=[]
|
||||
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
|
||||
*/
|
||||
|
@ -38,4 +38,4 @@ $(document).bind('toolbar_setup', function() {
|
||||
}, function() {
|
||||
$(this).find('.icon-home').removeClass('navbar-icon-home-hover');
|
||||
});
|
||||
})
|
||||
});
|
||||
|
@ -1 +1 @@
|
||||
1496
|
||||
1507
|
Loading…
x
Reference in New Issue
Block a user