This commit is contained in:
Rushabh Mehta 2012-04-10 11:51:51 +05:30
commit db05aacbc4
20 changed files with 153 additions and 37 deletions

View File

@ -46,6 +46,14 @@ class DocType:
else: else:
msgprint("Please enter atleast 1 invoice in the table below", raise_exception=1) msgprint("Please enter atleast 1 invoice in the table below", raise_exception=1)
self.calculate_total_invoiced_amount()
def calculate_total_invoiced_amount(self):
total = 0
for d in getlist(self.doclist, 'invoice_details'):
total += flt(d.grand_total)
webnotes.conn.set(self.doc, 'total_invoiced_amount', total)
def get_invoice_details(self, invoice_no): def get_invoice_details(self, invoice_no):
""" Pull details from invoices for referrence """ """ Pull details from invoices for referrence """

View File

@ -3,23 +3,25 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-03-27 14:35:41', 'creation': '2011-12-14 11:40:47',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-03-27 14:35:41', 'modified': '2012-04-06 17:29:50',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'Administrator' 'owner': u'Administrator'
}, },
# These values are common for all DocType # These values are common for all DocType
{ {
'_last_update': u'1323255350', '_last_update': u'1333712835',
'allow_attach': 1,
'colour': u'White:FFF', 'colour': u'White:FFF',
'doctype': 'DocType', 'doctype': 'DocType',
'max_attachments': 3,
'module': u'Accounts', 'module': u'Accounts',
'name': '__common__', 'name': '__common__',
'section_style': u'Simple', 'section_style': u'Simple',
'show_in_menu': 0, 'show_in_menu': 0,
'version': 11 'version': 19
}, },
# These values are common for all DocField # These values are common for all DocField
@ -79,6 +81,7 @@
'doctype': u'DocField', 'doctype': u'DocField',
'fieldname': u'column_break0', 'fieldname': u'column_break0',
'fieldtype': u'Column Break', 'fieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%' 'width': u'50%'
}, },
@ -89,6 +92,7 @@
'fieldtype': u'Select', 'fieldtype': u'Select',
'label': u'Series', 'label': u'Series',
'options': u'\nC-FORM/', 'options': u'\nC-FORM/',
'permlevel': 0,
'reqd': 1 'reqd': 1
}, },
@ -98,6 +102,7 @@
'fieldname': u'c_form_no', 'fieldname': u'c_form_no',
'fieldtype': u'Data', 'fieldtype': u'Data',
'label': u'C-Form No', 'label': u'C-Form No',
'permlevel': 0,
'reqd': 1 'reqd': 1
}, },
@ -107,6 +112,7 @@
'fieldname': u'received_date', 'fieldname': u'received_date',
'fieldtype': u'Date', 'fieldtype': u'Date',
'label': u'Received Date', 'label': u'Received Date',
'permlevel': 0,
'reqd': 1 'reqd': 1
}, },
@ -117,6 +123,7 @@
'fieldtype': u'Link', 'fieldtype': u'Link',
'label': u'Customer', 'label': u'Customer',
'options': u'Customer', 'options': u'Customer',
'permlevel': 0,
'reqd': 1 'reqd': 1
}, },
@ -125,6 +132,7 @@
'doctype': u'DocField', 'doctype': u'DocField',
'fieldname': u'column_break1', 'fieldname': u'column_break1',
'fieldtype': u'Column Break', 'fieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%' 'width': u'50%'
}, },
@ -134,7 +142,8 @@
'fieldname': u'company', 'fieldname': u'company',
'fieldtype': u'Select', 'fieldtype': u'Select',
'label': u'Company', 'label': u'Company',
'options': u'link:Company' 'options': u'link:Company',
'permlevel': 0
}, },
# DocField # DocField
@ -144,6 +153,7 @@
'fieldtype': u'Select', 'fieldtype': u'Select',
'label': u'Fiscal Year', 'label': u'Fiscal Year',
'options': u'link:Fiscal Year', 'options': u'link:Fiscal Year',
'permlevel': 0,
'reqd': 1 'reqd': 1
}, },
@ -153,7 +163,8 @@
'fieldname': u'quarter', 'fieldname': u'quarter',
'fieldtype': u'Select', 'fieldtype': u'Select',
'label': u'Quarter', 'label': u'Quarter',
'options': u'\nI\nII\nIII\nIV' 'options': u'\nI\nII\nIII\nIV',
'permlevel': 0
}, },
# DocField # DocField
@ -162,6 +173,7 @@
'fieldname': u'total_amount', 'fieldname': u'total_amount',
'fieldtype': u'Currency', 'fieldtype': u'Currency',
'label': u'Total Amount', 'label': u'Total Amount',
'permlevel': 0,
'reqd': 1 'reqd': 1
}, },
@ -172,6 +184,7 @@
'fieldtype': u'Select', 'fieldtype': u'Select',
'label': u'State', 'label': u'State',
'options': u"link:State\ncountry='India'", 'options': u"link:State\ncountry='India'",
'permlevel': 0,
'reqd': 1 'reqd': 1
}, },
@ -179,7 +192,8 @@
{ {
'doctype': u'DocField', 'doctype': u'DocField',
'fieldname': u'section_break0', 'fieldname': u'section_break0',
'fieldtype': u'Section Break' 'fieldtype': u'Section Break',
'permlevel': 0
}, },
# DocField # DocField
@ -188,6 +202,28 @@
'fieldname': u'invoice_details', 'fieldname': u'invoice_details',
'fieldtype': u'Table', 'fieldtype': u'Table',
'label': u'Invoice Details', 'label': u'Invoice Details',
'options': u'C-Form Invoice Detail' 'options': u'C-Form Invoice Detail',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'total_invoiced_amount',
'fieldtype': u'Currency',
'label': u'Total Invoiced Amount',
'permlevel': 1,
'print_hide': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'file_list',
'fieldtype': u'Text',
'hidden': 1,
'label': u'File List',
'permlevel': 0,
'print_hide': 1
} }
] ]

View File

@ -19,4 +19,12 @@ pscript['onload_accounts-home'] = function(wrapper) {
if(wn.control_panel.country!='India') { if(wn.control_panel.country!='India') {
$('.india-specific').toggle(false); $('.india-specific').toggle(false);
} }
if(wn.boot.profile.roles.indexOf('Accounts Manager')==-1 && wn.boot.profile.roles.indexOf('Accounts User')==-1) {
$('[href*="Accounts Browser"]').each(function() {
var txt = $(this).text();
$(this).parent().css('color', '#999').html(txt);
});
}
} }

View File

@ -226,7 +226,7 @@ class DocType(TransactionBase):
if d.fields.has_key(x): if d.fields.has_key(x):
d.fields[x] = f_lst[x] d.fields[x] = f_lst[x]
item = sql("select is_stock_item, is_purchase_item from tabItem where name=%s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())", d.item_code) item = sql("select is_stock_item, is_purchase_item, is_sub_contracted_item from tabItem where name=%s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())", d.item_code)
if not item: if not item:
msgprint("Item %s does not exist in Item Master." % cstr(d.item_code)) msgprint("Item %s does not exist in Item Master." % cstr(d.item_code))
raise Exception raise Exception
@ -238,10 +238,11 @@ class DocType(TransactionBase):
raise Exception raise Exception
# validate purchase item # validate purchase item
if not item[0][1]=='Yes': if item[0][1] != 'Yes' and item[0][2] != 'Yes':
msgprint("Item %s is not purchase item." % (d.item_code)) msgprint("Item %s is not a purchase item or sub-contracted item. Please check" % (d.item_code))
raise Exception raise Exception
if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname: if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname:
# check warehouse, uom in previous doc and in current doc are same. # check warehouse, uom in previous doc and in current doc are same.
data = sql("select item_code, warehouse, uom from `tab%s` where name = '%s'" % ( self.doctype_dict[d.prevdoc_doctype], d.prevdoc_detail_docname), as_dict = 1) data = sql("select item_code, warehouse, uom from `tab%s` where name = '%s'" % ( self.doctype_dict[d.prevdoc_doctype], d.prevdoc_detail_docname), as_dict = 1)

View File

@ -4,7 +4,7 @@
<h1>Buying</h1> <h1>Buying</h1>
<hr> <hr>
<div style="width: 48%; float: left;"> <div style="width: 48%; float: left;">
<h4><a href="#!List/Purchase Requisition">Purchase Requisition</a></h4> <h4><a href="#!List/Purchase Request">Purchase Request</a></h4>
<p class="help">Request for purchase</p> <p class="help">Request for purchase</p>
<h4><a href="#!List/Purchase Order">Purchase Order</a></h4> <h4><a href="#!List/Purchase Order">Purchase Order</a></h4>
<p class="help">Purchase Orders given to Suppliers</p> <p class="help">Purchase Orders given to Suppliers</p>

View File

View File

@ -0,0 +1,4 @@
def execute():
import webnotes
from webnotes.modules.module_manager import reload_doc
reload_doc('accounts', 'doctype', 'c_form')

View File

@ -161,7 +161,7 @@ def update_dt_in_records(rendt):
webnotes.conn.sql("update `tabGL Entry` set voucher_type = replace(voucher_type, '%s', '%s') where voucher_type = '%s'" % (d, rendt[d], d)) webnotes.conn.sql("update `tabGL Entry` set voucher_type = replace(voucher_type, '%s', '%s') where voucher_type = '%s'" % (d, rendt[d], d))
# Stock ledger entry # Stock ledger entry
webnotes.conn.sql("update `tabStock ledger Entry` set voucher_type = replace(voucher_type, '%s', '%s') where voucher_type = '%s'" % (d, rendt[d], d)) webnotes.conn.sql("update `tabStock Ledger Entry` set voucher_type = replace(voucher_type, '%s', '%s') where voucher_type = '%s'" % (d, rendt[d], d))
# Custom fld: options # Custom fld: options
webnotes.conn.sql("update `tabCustom Field` set options = replace(options, %s, %s) where fieldtype in ('Link', 'Select')", (d, rendt[d])) webnotes.conn.sql("update `tabCustom Field` set options = replace(options, %s, %s) where fieldtype in ('Link', 'Select')", (d, rendt[d]))

View File

@ -0,0 +1,14 @@
def execute():
import webnotes
webnotes.conn.sql("""
UPDATE `tabDocField`
SET fieldtype = 'Link', options = 'Deduction Type'
WHERE parent = 'Deduction Detail'
AND fieldname = 'd_type'
""")
webnotes.conn.sql("""
UPDATE `tabDocField`
SET fieldtype = 'Link', options = 'Earning Type'
WHERE parent = 'Earning Detail'
AND fieldname = 'e_type'
""")

View File

@ -261,5 +261,10 @@ patch_list = [
'patch_module': 'patches.mar_2012', 'patch_module': 'patches.mar_2012',
'patch_file': 'usertags', 'patch_file': 'usertags',
'description': 'Adds _user_tags columns to tables' 'description': 'Adds _user_tags columns to tables'
} },
{
'patch_module': 'patches.april_2012',
'patch_file': 'reload_c_form',
'description': 'Added attchemnt option and total field'
},
] ]

View File

@ -157,11 +157,18 @@ cur_frm.cscript.hide_price_list_currency = function(doc, cdt, cdn, callback1) {
args: {'price_list':doc.price_list_name, 'company': doc.company}, args: {'price_list':doc.price_list_name, 'company': doc.company},
callback: function(r, rt) { callback: function(r, rt) {
pl_currency = r.message[0]?r.message[0]:[]; pl_currency = r.message[0]?r.message[0]:[];
unhide_field(['price_list_currency', 'plc_conversion_rate']);
if (pl_currency.length==1) { if (pl_currency.length==1) {
if (pl_currency[0] == doc.currency) set_multiple(cdt, cdn, {price_list_currency:doc.currency, plc_conversion_rate:doc.conversion_rate}); set_multiple(cdt, cdn, {price_list_currency:pl_currency[0]});
else if (pl_currency[0] = r.message[1]) set_multiple(cdt, cdn, {price_list_currency:pl_currency[0], plc_conversion_rate:1}) if (pl_currency[0] == doc.currency) {
hide_field(['price_list_currency', 'plc_conversion_rate']); set_multiple(cdt, cdn, {plc_conversion_rate:doc.conversion_rate});
} else unhide_field(['price_list_currency', 'plc_conversion_rate']); hide_field(['price_list_currency', 'plc_conversion_rate']);
} else if (pl_currency[0] == r.message[1]) {
set_multiple(cdt, cdn, {plc_conversion_rate:1})
hide_field(['price_list_currency', 'plc_conversion_rate']);
}
}
if (r.message[1] == doc.currency) { if (r.message[1] == doc.currency) {
set_multiple(cdt, cdn, {conversion_rate:1}); set_multiple(cdt, cdn, {conversion_rate:1});

View File

@ -240,7 +240,9 @@ class DocType:
Adds common conditions in dictionary "args" Adds common conditions in dictionary "args"
""" """
start_date, end_date = self.get_start_end_dates() start_date, end_date = self.get_start_end_dates()
fiscal_start_date = webnotes.utils.get_defaults()['year_start_date'] fiscal_year = webnotes.utils.get_defaults()['fiscal_year']
fiscal_start_date = webnotes.conn.get_value('Fiscal Year', fiscal_year,
'year_start_date')
if 'new' in args['type']: if 'new' in args['type']:
args.update({ args.update({

View File

@ -19,6 +19,7 @@ import webnotes
from webnotes.utils import cint, cstr from webnotes.utils import cint, cstr
from webnotes import msgprint, errprint from webnotes import msgprint, errprint
import webnotes.model.doctype
sql = webnotes.conn.sql sql = webnotes.conn.sql
@ -31,13 +32,13 @@ class DocType:
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
def get_transactions(self): 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): def get_options_for(self, doctype):
sr = sql("select options from `tabDocField` where parent='%s' and fieldname='naming_series'" % (doctype)) sr = webnotes.model.doctype.get_property(doctype, 'naming_series')
if sr and sr[0][0]: if sr:
return sr[0][0].split("\n") return sr.split("\n")
else: else:
return [] return []
@ -50,7 +51,7 @@ class DocType:
options = self.scrub_options_list(ol) options = self.scrub_options_list(ol)
# validate names # 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: if self.doc.user_must_always_select:
options = [''] + options options = [''] + options
@ -58,8 +59,28 @@ class DocType:
else: else:
default = options[0] default = options[0]
# update # update in property setter
sql("update tabDocField set `options`=%s, `default`=%s where parent=%s and fieldname='naming_series'", ("\n".join(options), default, doctype)) 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) self.doc.set_options = "\n".join(options)
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@ -73,7 +94,8 @@ class DocType:
from core.doctype.doctype.doctype import DocType from core.doctype.doctype.doctype import DocType
dt = 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")) options = self.scrub_options_list(self.doc.set_options.split("\n"))
for series in options: for series in options:
dt.validate_series(series, self.doc.select_doc_for_series) dt.validate_series(series, self.doc.select_doc_for_series)

View File

@ -171,3 +171,4 @@ erpnext.set_user_background = function(src) {
$(document).bind('startup', function() { $(document).bind('startup', function() {
erpnext.startup.start(); erpnext.startup.start();
}); });

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

BIN
images/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -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.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) 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);});} 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) 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);}}}); return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}});
/* /*
@ -2140,7 +2140,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();} 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) $(document).trigger('startup');try{if(wn.control_panel.custom_startup_code)
eval(wn.control_panel.custom_startup_code);}catch(e){errprint(e);} 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');} 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();} 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) if(wn.boot){LocalDB.sync(wn.boot.docs);callback(wn.boot,'');if(wn.boot.error_messages)
@ -2167,12 +2167,16 @@ var resize_observers=[]
function set_resize_observer(fn){if(resize_observers.indexOf(fn)==-1)resize_observers.push(fn);} 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);}} 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;} 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 * 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:'&copy; Web Notes Technologies Pvt Ltd',version:'2.'+window._version_number} 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:'&copy; 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\ 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 * erpnext/startup/startup.js
*/ */

View File

@ -127,7 +127,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.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) 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);});} 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) 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);}}}); return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}});
/* /*
@ -839,7 +839,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();} 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) $(document).trigger('startup');try{if(wn.control_panel.custom_startup_code)
eval(wn.control_panel.custom_startup_code);}catch(e){errprint(e);} 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');} 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();} 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) if(wn.boot){LocalDB.sync(wn.boot.docs);callback(wn.boot,'');if(wn.boot.error_messages)
@ -866,12 +866,16 @@ var resize_observers=[]
function set_resize_observer(fn){if(resize_observers.indexOf(fn)==-1)resize_observers.push(fn);} 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);}} 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;} 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 * 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:'&copy; Web Notes Technologies Pvt Ltd',version:'2.'+window._version_number} 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:'&copy; 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\ 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 * erpnext/startup/startup.js
*/ */

View File

@ -38,4 +38,4 @@ $(document).bind('toolbar_setup', function() {
}, function() { }, function() {
$(this).find('.icon-home').removeClass('navbar-icon-home-hover'); $(this).find('.icon-home').removeClass('navbar-icon-home-hover');
}); });
}) });