updated account url and js version
This commit is contained in:
parent
b7d831b734
commit
764fdb942e
@ -1,6 +1,7 @@
|
|||||||
pscript.onload_dashboard = function() {
|
pscript.onload_dashboard = function() {
|
||||||
// load jqplot
|
// load jqplot
|
||||||
$.scriptPath = 'js/'
|
$.scriptPath = 'js/'
|
||||||
|
wn.require('lib/css/jqpot.css');
|
||||||
wn.require('lib/js/legacy/jquery/jquery.jqplot.min.js');
|
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.barRenderer.js');
|
||||||
wn.require('lib/js/legacy/jquery/jqplot-plugins/jqplot.canvasAxisTickRenderer.min.js');
|
wn.require('lib/js/legacy/jquery/jqplot-plugins/jqplot.canvasAxisTickRenderer.min.js');
|
||||||
|
@ -2,8 +2,10 @@ import webnotes
|
|||||||
from webnotes.model.doc import Document
|
from webnotes.model.doc import Document
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
|
from webnotes.modules import reload_doc
|
||||||
add_default_home_page()
|
add_default_home_page()
|
||||||
cleanup()
|
cleanup()
|
||||||
|
reload_doc('setup','doctype','manage_account')
|
||||||
|
|
||||||
def cleanup():
|
def cleanup():
|
||||||
from webnotes.model import delete_doc
|
from webnotes.model import delete_doc
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Validate
|
// Validate
|
||||||
cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
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;
|
sys_defaults = r.message;
|
||||||
});
|
});
|
||||||
}
|
}
|
@ -1,66 +1,60 @@
|
|||||||
# Please edit this list and import only required elements
|
"""Global Defaults"""
|
||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import cint, cstr, get_defaults, set_default, fmt_money, get_last_day, get_first_day
|
keydict = {
|
||||||
from webnotes import session, form, is_testing, msgprint, errprint
|
"fiscal_year": "current_fiscal_year",
|
||||||
|
'company': 'default_company',
|
||||||
sql = webnotes.conn.sql
|
'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:
|
class DocType:
|
||||||
def __init__(self, d, dl):
|
def __init__(self, d, dl):
|
||||||
self.doc, self.doclist = d, dl
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------------------------------------------------------------
|
def get_bal(self,arg):
|
||||||
def get_bal(self,arg):
|
"""get account balance (??)"""
|
||||||
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))
|
from webnotes.utils import fmt_money, flt
|
||||||
if bal:
|
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))
|
||||||
return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]
|
if bal:
|
||||||
|
return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
# Update Default
|
for key in keydict:
|
||||||
# ---------------
|
webnotes.conn.set_default(key, self.doc.fields.get(keydict[key], ''))
|
||||||
def set_system_default(self, defkey, defvalue):
|
|
||||||
set_default(defkey, defvalue)
|
|
||||||
|
|
||||||
if defkey == 'fiscal_year':
|
# update year start date and year end date from fiscal_year
|
||||||
ysd = sql("select year_start_date from `tabFiscal Year` where name=%s", cstr(defvalue))
|
ysd = webnotes.conn.sql("""select year_start_date from `tabFiscal Year`
|
||||||
ysd = ysd and ysd[0][0] or ''
|
where name=%s""", self.doc.fiscal_year)
|
||||||
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'))
|
|
||||||
|
|
||||||
|
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'))
|
||||||
|
|
||||||
# Update
|
def get_defaults(self):
|
||||||
# --------
|
return webnotes.conn.get_defaults()
|
||||||
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
|
|
||||||
|
|
||||||
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()
|
|
||||||
|
|
@ -5,14 +5,13 @@
|
|||||||
{
|
{
|
||||||
'creation': '2010-08-08 17:09:09',
|
'creation': '2010-08-08 17:09:09',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2011-12-21 13:22:33',
|
'modified': '2012-01-20 11:25:18',
|
||||||
'modified_by': 'Administrator',
|
'modified_by': 'Administrator',
|
||||||
'owner': 'Administrator'
|
'owner': 'Administrator'
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocType
|
# These values are common for all DocType
|
||||||
{
|
{
|
||||||
|
|
||||||
'_last_update': '1323855502',
|
'_last_update': '1323855502',
|
||||||
'allow_copy': 1,
|
'allow_copy': 1,
|
||||||
'allow_email': 1,
|
'allow_email': 1,
|
||||||
@ -29,7 +28,7 @@
|
|||||||
'section_style': 'Tabbed',
|
'section_style': 'Tabbed',
|
||||||
'server_code_error': ' ',
|
'server_code_error': ' ',
|
||||||
'show_in_menu': 1,
|
'show_in_menu': 1,
|
||||||
'version': 515
|
'version': 517
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocField
|
# These values are common for all DocField
|
||||||
@ -102,6 +101,37 @@
|
|||||||
'write': 1
|
'write': 1
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'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
|
# DocField
|
||||||
{
|
{
|
||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
@ -173,14 +203,6 @@
|
|||||||
'label': 'Default Currency Fraction'
|
'label': 'Default Currency Fraction'
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
|
||||||
'doctype': 'DocField',
|
|
||||||
'fieldname': 'sms_sender_name',
|
|
||||||
'fieldtype': 'Data',
|
|
||||||
'label': 'SMS Sender Name'
|
|
||||||
},
|
|
||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
{
|
{
|
||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>ERPNext</title>
|
<title>ERPNext</title>
|
||||||
<meta name="author" content="">
|
<meta name="author" content="">
|
||||||
<script type="text/javascript">window._version_number="49"
|
<script type="text/javascript">window._version_number="52"
|
||||||
|
|
||||||
wn={}
|
wn={}
|
||||||
wn.provide=function(namespace){var nsl=namespace.split('.');var l=nsl.length;var parent=window;for(var i=0;i<l;i++){var n=nsl[i];if(!parent[n]){parent[n]={}}
|
wn.provide=function(namespace){var nsl=namespace.split('.');var l=nsl.length;var parent=window;for(var i=0;i<l;i++){var n=nsl[i];if(!parent[n]){parent[n]={}}
|
||||||
parent=parent[n];}}
|
parent=parent[n];}}
|
||||||
|
@ -1 +1 @@
|
|||||||
49
|
52
|
Loading…
x
Reference in New Issue
Block a user