updated account url and js version
diff --git a/erpnext/home/page/dashboard/dashboard.js b/erpnext/home/page/dashboard/dashboard.js
index aac42a3..8ef2ffb 100644
--- a/erpnext/home/page/dashboard/dashboard.js
+++ b/erpnext/home/page/dashboard/dashboard.js
@@ -1,6 +1,7 @@
pscript.onload_dashboard = function() {
// load jqplot
$.scriptPath = 'js/'
+ wn.require('lib/css/jqpot.css');
wn.require('lib/js/legacy/jquery/jquery.jqplot.min.js');
wn.require('lib/js/legacy/jquery/jqplot-plugins/jqplot.barRenderer.js');
wn.require('lib/js/legacy/jquery/jqplot-plugins/jqplot.canvasAxisTickRenderer.min.js');
diff --git a/erpnext/patches/jan_mar_2012/subdomain_login_patch.py b/erpnext/patches/jan_mar_2012/subdomain_login_patch.py
index b0633cc..edfcb66 100644
--- a/erpnext/patches/jan_mar_2012/subdomain_login_patch.py
+++ b/erpnext/patches/jan_mar_2012/subdomain_login_patch.py
@@ -2,9 +2,11 @@
from webnotes.model.doc import Document
def execute():
+ from webnotes.modules import reload_doc
add_default_home_page()
cleanup()
-
+ reload_doc('setup','doctype','manage_account')
+
def cleanup():
from webnotes.model import delete_doc
delete_doc("DocType", "SSO Control")
diff --git a/erpnext/setup/doctype/manage_account/manage_account.js b/erpnext/setup/doctype/manage_account/manage_account.js
index 7c3b193..63cc1d5 100644
--- a/erpnext/setup/doctype/manage_account/manage_account.js
+++ b/erpnext/setup/doctype/manage_account/manage_account.js
@@ -1,6 +1,6 @@
// Validate
cur_frm.cscript.validate = function(doc, cdt, cdn) {
- $c_obj(make_doclist(cdt, cdn), 'update_cp', '', function(r, rt){
+ $c_obj(make_doclist(cdt, cdn), 'get_defaults', '', function(r, rt){
sys_defaults = r.message;
});
}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/manage_account/manage_account.py b/erpnext/setup/doctype/manage_account/manage_account.py
index 5b1292a..757d323 100644
--- a/erpnext/setup/doctype/manage_account/manage_account.py
+++ b/erpnext/setup/doctype/manage_account/manage_account.py
@@ -1,66 +1,60 @@
-# Please edit this list and import only required elements
+"""Global Defaults"""
import webnotes
-from webnotes.utils import cint, cstr, get_defaults, set_default, fmt_money, get_last_day, get_first_day
-from webnotes import session, form, is_testing, msgprint, errprint
-
-sql = webnotes.conn.sql
-
-
-# -----------------------------------------------------------------------------------------
-
+keydict = {
+ "fiscal_year": "current_fiscal_year",
+ 'company': 'default_company',
+ 'currency': 'default_currency',
+ 'price_list_name': 'default_price_list',
+ 'price_list_currency': 'default_price_list_currency',
+ 'item_group': 'default_item_group',
+ 'customer_group': 'default_customer_group',
+ 'cust_master_name': 'cust_master_name',
+ 'supplier_type': 'default_supplier_type',
+ 'supp_master_name': 'supp_master_name',
+ 'territory': 'default_territory',
+ 'stock_uom': 'default_stock_uom',
+ 'fraction_currency': 'default_currency_fraction',
+ 'valuation_method': 'default_valuation_method',
+ 'date_format': 'date_format',
+ 'currency_format':'default_currency_format',
+ 'account_url':'account_url'
+}
class DocType:
- def __init__(self, d, dl):
- self.doc, self.doclist = d, dl
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
-#---------------------------------------------------------------------------------------------------------------------------------------------
- def get_bal(self,arg):
- bal = sql("select `tabAccount Balance`.balance,`tabAccount`.debit_or_credit from `tabAccount`,`tabAccount Balance` where `tabAccount Balance`.account=%s and `tabAccount Balance`.period=%s and `tabAccount Balance`.account=`tabAccount`.name ",(arg,self.doc.current_fiscal_year))
- if bal:
- return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]
-
-
-# =========================================================================================================================================
-
- # Update Default
- # ---------------
- def set_system_default(self, defkey, defvalue):
- set_default(defkey, defvalue)
-
- if defkey == 'fiscal_year':
- ysd = sql("select year_start_date from `tabFiscal Year` where name=%s", cstr(defvalue))
- ysd = ysd and ysd[0][0] or ''
- if ysd:
- set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
- set_default('year_end_date', get_last_day(get_first_day(ysd,0,11)).strftime('%Y-%m-%d'))
-
-
- # Update
- # --------
- def update_cp(self):
- def_list = [['fiscal_year',self.doc.current_fiscal_year],
- ['company',self.doc.default_company],
- ['currency',self.doc.default_currency],
- ['price_list_name',self.doc.default_price_list or ''],
- ['price_list_currency', self.doc.default_price_list_currency or ''],
- ['item_group',self.doc.default_item_group or ''],
- ['customer_group',self.doc.default_customer_group or ''],
- ['cust_master_name',self.doc.cust_master_name or ''],
- ['supplier_type',self.doc.default_supplier_type or ''],
- ['supp_master_name',self.doc.supp_master_name],
- ['territory',self.doc.default_territory or ''],
- ['stock_uom',self.doc.default_stock_uom or ''],
- ['fraction_currency',self.doc.default_currency_fraction or ''],
- ['valuation_method',self.doc.default_valuation_method]]
-
- for d in def_list:
- self.set_system_default(d[0],d[1])
- # Update Currency Format
+ def get_bal(self,arg):
+ """get account balance (??)"""
+ from webnotes.utils import fmt_money, flt
+ bal = webnotes.conn.sql("select `tabAccount Balance`.balance,`tabAccount`.debit_or_credit from `tabAccount`,`tabAccount Balance` where `tabAccount Balance`.account=%s and `tabAccount Balance`.period=%s and `tabAccount Balance`.account=`tabAccount`.name ",(arg,self.doc.current_fiscal_year))
+ if bal:
+ return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]
- sql("update `tabSingles` set value = '%s' where field = 'currency_format' and doctype = 'Control Panel'" % self.doc.default_currency_format)
- sql("update `tabSingles` set value = '%s' where field = 'date_format' and doctype = 'Control Panel'" %self.doc.date_format)
-
-
- return get_defaults()
-
+ def validate(self):
+ """validate"""
+ if not (self.doc.account_url and (self.doc.account_url.startswith('http://') \
+ or self.doc.account_url.startswith('https://'))):
+ webnotes.msgprint("Account URL must start with 'http://' or 'https://'", raise_exception=1)
+
+ def on_update(self):
+ """update defaults"""
+ self.validate()
+
+ for key in keydict:
+ webnotes.conn.set_default(key, self.doc.fields.get(keydict[key], ''))
+
+ # update year start date and year end date from fiscal_year
+ ysd = webnotes.conn.sql("""select year_start_date from `tabFiscal Year`
+ where name=%s""", self.doc.fiscal_year)
+
+ ysd = ysd and ysd[0][0] or ''
+ from webnotes.utils import get_first_day, get_last_day
+ if ysd:
+ webnotes.conn.set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
+ webnotes.conn.set_default('year_end_date', \
+ get_last_day(get_first_day(ysd,0,11)).strftime('%Y-%m-%d'))
+
+ def get_defaults(self):
+ return webnotes.conn.get_defaults()
\ No newline at end of file
diff --git a/erpnext/setup/doctype/manage_account/manage_account.txt b/erpnext/setup/doctype/manage_account/manage_account.txt
index 8a156a0..18a9872 100644
--- a/erpnext/setup/doctype/manage_account/manage_account.txt
+++ b/erpnext/setup/doctype/manage_account/manage_account.txt
@@ -5,14 +5,13 @@
{
'creation': '2010-08-08 17:09:09',
'docstatus': 0,
- 'modified': '2011-12-21 13:22:33',
+ 'modified': '2012-01-20 11:25:18',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
-
'_last_update': '1323855502',
'allow_copy': 1,
'allow_email': 1,
@@ -29,7 +28,7 @@
'section_style': 'Tabbed',
'server_code_error': ' ',
'show_in_menu': 1,
- 'version': 515
+ 'version': 517
},
# These values are common for all DocField
@@ -106,6 +105,37 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
+ 'label': 'System'
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Example: http://frappe.erpnext.com',
+ 'doctype': 'DocField',
+ 'fieldname': 'account_url',
+ 'fieldtype': 'Data',
+ 'label': 'Account URL'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Column Break'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'sms_sender_name',
+ 'fieldtype': 'Data',
+ 'label': 'SMS Sender Name'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Section Break',
'label': 'Company'
},
@@ -176,14 +206,6 @@
# DocField
{
'doctype': 'DocField',
- 'fieldname': 'sms_sender_name',
- 'fieldtype': 'Data',
- 'label': 'SMS Sender Name'
- },
-
- # DocField
- {
- 'doctype': 'DocField',
'fieldtype': 'Section Break',
'label': 'Stock'
},
@@ -510,4 +532,4 @@
'label': 'Employee Records to be created by ',
'options': '\nNaming Series\nEmployee Number'
}
-]
+]
\ No newline at end of file