added activity page
This commit is contained in:
parent
a38bbe28ce
commit
12852e73ab
@ -78,6 +78,7 @@
|
||||
"lib/js/lib/jquery.min.js:concat",
|
||||
"lib/js/lib/history/history.min.js:concat",
|
||||
"lib/js/lib/bootstrap.min.js:concat",
|
||||
"lib/js/lib/sprintf.js",
|
||||
"lib/js/core.min.js:concat",
|
||||
"lib/js/legacy/globals.js",
|
||||
"lib/js/legacy/utils/datatype.js",
|
||||
@ -121,6 +122,7 @@
|
||||
"lib/js/legacy/jquery/jquery-ui.min.js:concat",
|
||||
"lib/js/legacy/tiny_mce_33/jquery.tinymce.js:concat",
|
||||
"lib/js/lib/bootstrap.min.js:concat",
|
||||
"lib/js/lib/sprintf.js",
|
||||
"lib/js/core.min.js:concat",
|
||||
"lib/js/legacy/globals.js",
|
||||
"lib/js/legacy/utils/datatype.js",
|
||||
@ -175,9 +177,9 @@
|
||||
"lib/js/legacy/app.js",
|
||||
"js/app.js",
|
||||
"erpnext/startup/startup.js",
|
||||
"erpnext/startup/modules.js",
|
||||
"erpnext/startup/toolbar.js",
|
||||
"erpnext/startup/feature_setup.js"
|
||||
"erpnext/startup/js/modules.js",
|
||||
"erpnext/startup/js/toolbar.js",
|
||||
"erpnext/startup/js/feature_setup.js"
|
||||
]
|
||||
}
|
||||
|
||||
|
0
erpnext/home/page/activity/__init__.py
Normal file
0
erpnext/home/page/activity/__init__.py
Normal file
23
erpnext/home/page/activity/activity.css
Normal file
23
erpnext/home/page/activity/activity.css
Normal file
@ -0,0 +1,23 @@
|
||||
#activity-list .label {
|
||||
display: inline-block;
|
||||
width: 100px;
|
||||
margin-right: 7px;
|
||||
}
|
||||
|
||||
#activity-list .label-info {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#activity-list .user-info {
|
||||
float: right;
|
||||
color: #777;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
#activity-list .date-sep {
|
||||
margin-bottom: 11px;
|
||||
padding: 5px 0px;
|
||||
border-bottom: 1px solid #aaa;
|
||||
color: #555;
|
||||
font-size: 10px;
|
||||
}
|
6
erpnext/home/page/activity/activity.html
Normal file
6
erpnext/home/page/activity/activity.html
Normal file
@ -0,0 +1,6 @@
|
||||
<div class="layout-wrapper">
|
||||
<a class="close" onclick="window.history.back();">×</a>
|
||||
<h1>Activity</h1>
|
||||
<div id="activity-list">
|
||||
</div>
|
||||
</div>
|
57
erpnext/home/page/activity/activity.js
Normal file
57
erpnext/home/page/activity/activity.js
Normal file
@ -0,0 +1,57 @@
|
||||
wn.pages['activity'].onload = function(wrapper) {
|
||||
var list = new wn.widgets.Listing({
|
||||
method: 'home.page.activity.activity.get_feed',
|
||||
parent: $('#activity-list'),
|
||||
render_row: function(row, data) {
|
||||
new erpnext.ActivityFeed(row, data);
|
||||
}
|
||||
});
|
||||
list.run();
|
||||
}
|
||||
|
||||
erpnext.last_feed_date = false;
|
||||
erpnext.ActivityFeed = Class.extend({
|
||||
init: function(row, data) {
|
||||
this.scrub_data(data);
|
||||
this.add_date_separator(row, data);
|
||||
$(row).append(repl('<span %(onclick)s\
|
||||
class="label %(add_class)s">%(feed_type)s</span>\
|
||||
%(link)s %(subject)s <span class="user-info">%(by)s</span>', data));
|
||||
},
|
||||
scrub_data: function(data) {
|
||||
data.by = wn.boot.user_fullnames[data.owner];
|
||||
|
||||
// feedtype
|
||||
if(!data.feed_type) {
|
||||
data.feed_type = get_doctype_label(data.doc_type);
|
||||
data.add_class = "label-info";
|
||||
data.onclick = repl('onclick="window.location.href=\'#!List/%(feed_type)s\';"', data)
|
||||
}
|
||||
|
||||
// color for comment
|
||||
if(data.feed_type=='Comment') {
|
||||
data.add_class = "label-important";
|
||||
}
|
||||
|
||||
// link
|
||||
if(data.doc_name && data.feed_type!='Login') {
|
||||
data.link = repl('<a href="#!Form/%(doc_type)s/%(doc_name)s">%(doc_name)s</a>', data)
|
||||
}
|
||||
},
|
||||
add_date_separator: function(row, data) {
|
||||
var date = dateutil.str_to_obj(data.modified);
|
||||
var last = erpnext.last_feed_date;
|
||||
|
||||
if((last && dateutil.get_diff(last, date)>1) || (!last)) {
|
||||
var pdate = dateutil.comment_when(date);
|
||||
var diff = dateutil.get_diff(new Date(), date);
|
||||
if(diff < 1) {
|
||||
pdate = 'Today';
|
||||
} else if(diff > 6) {
|
||||
pdate = dateutil.global_date_format(date);
|
||||
}
|
||||
$(row).html(repl('<div class="date-sep">%(date)s</div>', {date: pdate}));
|
||||
}
|
||||
erpnext.last_feed_date = date;
|
||||
}
|
||||
})
|
16
erpnext/home/page/activity/activity.py
Normal file
16
erpnext/home/page/activity/activity.py
Normal file
@ -0,0 +1,16 @@
|
||||
import webnotes
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_feed(arg=None):
|
||||
"""get feed"""
|
||||
return webnotes.conn.sql("""select
|
||||
distinct t1.name, t1.feed_type, t1.doc_type, t1.doc_name, t1.subject, t1.owner,
|
||||
t1.modified
|
||||
from tabFeed t1, tabDocPerm t2
|
||||
where t1.doc_type = t2.parent
|
||||
and t2.role in ('%s')
|
||||
and ifnull(t2.`read`,0) = 1
|
||||
order by t1.modified desc
|
||||
limit %s, %s""" % ("','".join(webnotes.get_roles()),
|
||||
webnotes.form_dict['limit_start'], webnotes.form_dict['limit_page_length']),
|
||||
as_dict=1)
|
28
erpnext/home/page/activity/activity.txt
Normal file
28
erpnext/home/page/activity/activity.txt
Normal file
@ -0,0 +1,28 @@
|
||||
# Page, activity
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-02-29 11:59:13',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-02-29 12:11:46',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Page
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'module': u'Home',
|
||||
'name': '__common__',
|
||||
'page_name': u'activity',
|
||||
'standard': u'Yes',
|
||||
'title': u'Activity'
|
||||
},
|
||||
|
||||
# Page, activity
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'name': u'activity'
|
||||
}
|
||||
]
|
@ -3,12 +3,12 @@ wn.provide('erpnext.desktop');
|
||||
erpnext.desktop.gradient = "<style>\
|
||||
.case-%(name)s {\
|
||||
background: %(start)s; /* Old browsers */\
|
||||
background: -moz-radial-gradient(center, ellipse cover, %(start)s 0%, %(middle)s 44%, %(end)s 100%); /* FF3.6+ */\
|
||||
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,%(start)s), color-stop(44%,%(middle)s), color-stop(100%,%(end)s)); /* Chrome,Safari4+ */\
|
||||
background: -webkit-radial-gradient(center, ellipse cover, %(start)s 0%,%(middle)s 44%,%(end)s 100%); /* Chrome10+,Safari5.1+ */\
|
||||
background: -o-radial-gradient(center, ellipse cover, %(start)s 0%,%(middle)s 44%,%(end)s 100%); /* Opera 12+ */\
|
||||
background: -ms-radial-gradient(center, ellipse cover, %(start)s 0%,%(middle)s 44%,%(end)s 100%); /* IE10+ */\
|
||||
background: radial-gradient(center, ellipse cover, %(start)s 0%,%(middle)s 44%,%(end)s 100%); /* W3C */\
|
||||
background: -moz-radial-gradient(center, ellipse cover, %(start)s 0%%, %(middle)s 44%%, %(end)s 100%%); /* FF3.6+ */\
|
||||
background: -webkit-gradient(radial, center center, 0px, center center, 100%%, color-stop(0%%,%(start)s), color-stop(44%%,%(middle)s), color-stop(100%%,%(end)s)); /* Chrome,Safari4+ */\
|
||||
background: -webkit-radial-gradient(center, ellipse cover, %(start)s 0%%,%(middle)s 44%%,%(end)s 100%%); /* Chrome10+,Safari5.1+ */\
|
||||
background: -o-radial-gradient(center, ellipse cover, %(start)s 0%%,%(middle)s 44%%,%(end)s 100%%); /* Opera 12+ */\
|
||||
background: -ms-radial-gradient(center, ellipse cover, %(start)s 0%%,%(middle)s 44%%,%(end)s 100%%); /* IE10+ */\
|
||||
background: radial-gradient(center, ellipse cover, %(start)s 0%%,%(middle)s 44%%,%(end)s 100%%); /* W3C */\
|
||||
}\
|
||||
</style>"
|
||||
|
||||
@ -79,7 +79,7 @@ erpnext.desktop.render = function() {
|
||||
|
||||
for(var i in wn.boot.modules_list) {
|
||||
var m = wn.boot.modules_list[i];
|
||||
if(m!='Setup');
|
||||
if(m!='Setup')
|
||||
add_icon(m);
|
||||
}
|
||||
|
||||
|
@ -1,124 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// complete my company registration
|
||||
// --------------------------------
|
||||
pscript.complete_registration = function(is_complete, profile) {
|
||||
if(is_complete == 'No'){
|
||||
var d = new Dialog(400, 200, "Setup your Account");
|
||||
if(user != 'Administrator'){
|
||||
d.no_cancel(); // Hide close image
|
||||
$('header').toggle(false);
|
||||
}
|
||||
|
||||
d.make_body([
|
||||
['HTML', 'Your Profile Details', '<h4>Your Profile Details</h4>'],
|
||||
['Data', 'First Name'],
|
||||
['Data', 'Last Name'],
|
||||
['HTML', 'Company Details', '<h4>Create your first company</h4>'],
|
||||
['Data','Company Name','Example: Your Company LLC'],
|
||||
['Data','Company Abbreviation', 'Example: YC (all your acconts will have this as a suffix)'],
|
||||
['Select','Fiscal Year Start Date'],
|
||||
['Select','Default Currency'],
|
||||
['Button','Save'],
|
||||
]);
|
||||
|
||||
// if company name is set, set the input value
|
||||
// and disable it
|
||||
if(wn.control_panel.company_name) {
|
||||
d.widgets['Company Name'].value = wn.control_panel.company_name;
|
||||
d.widgets['Company Name'].disabled = 1;
|
||||
}
|
||||
|
||||
if(profile && profile.length>0) {
|
||||
if(profile[0].first_name && profile[0].first_name!='None') {
|
||||
d.widgets['First Name'].value = profile[0].first_name;
|
||||
}
|
||||
|
||||
if(profile[0].last_name && profile[0].last_name!='None') {
|
||||
d.widgets['Last Name'].value = profile[0].last_name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//d.widgets['Save'].disabled = true; // disable Save button
|
||||
pscript.make_dialog_field(d);
|
||||
|
||||
// submit details
|
||||
d.widgets['Save'].onclick = function()
|
||||
{
|
||||
d.widgets['Save'].set_working();
|
||||
|
||||
flag = pscript.validate_fields(d);
|
||||
if(flag)
|
||||
{
|
||||
var args = [
|
||||
d.widgets['Company Name'].value,
|
||||
d.widgets['Company Abbreviation'].value,
|
||||
d.widgets['Fiscal Year Start Date'].value,
|
||||
d.widgets['Default Currency'].value,
|
||||
d.widgets['First Name'].value,
|
||||
d.widgets['Last Name'].value
|
||||
];
|
||||
|
||||
$c_obj('Setup Control','setup_account',JSON.stringify(args),function(r, rt){
|
||||
sys_defaults = r.message;
|
||||
user_fullname = r.message.user_fullname;
|
||||
d.hide();
|
||||
$('header').toggle(true);
|
||||
page_body.wntoolbar.set_user_name();
|
||||
});
|
||||
} else {
|
||||
d.widgets['Save'].done_working();
|
||||
}
|
||||
}
|
||||
d.show();
|
||||
}
|
||||
}
|
||||
|
||||
// make dialog fields
|
||||
// ------------------
|
||||
pscript.make_dialog_field = function(d)
|
||||
{
|
||||
// fiscal year format
|
||||
fisc_format = d.widgets['Fiscal Year Start Date'];
|
||||
add_sel_options(fisc_format, ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct']);
|
||||
|
||||
// default currency
|
||||
currency_list = ['', 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AZN', 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BYR', 'BZD', 'CAD', 'CDF', 'CFA', 'CFP', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD', 'EEK', 'EGP', 'ERN', 'ETB', 'EUR', 'EURO', 'FJD', 'FKP', 'FMG', 'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GQE', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LVL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZM', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NRs', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RMB', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SCR', 'SDG', 'SDR', 'SEK', 'SGD', 'SHP', 'SOS', 'SRD', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TRY', 'TTD', 'TWD', 'TZS', 'UAE', 'UAH', 'UGX', 'USD', 'USh', 'UYU', 'UZS', 'VEB', 'VND', 'VUV', 'WST', 'XAF', 'XCD', 'XDR', 'XOF', 'XPF', 'YEN', 'YER', 'YTL', 'ZAR', 'ZMK', 'ZWR'];
|
||||
currency = d.widgets['Default Currency'];
|
||||
add_sel_options(currency, currency_list);
|
||||
}
|
||||
|
||||
|
||||
// validate fields
|
||||
// ---------------
|
||||
pscript.validate_fields = function(d)
|
||||
{
|
||||
var lst = ['First Name', 'Company Name', 'Company Abbreviation', 'Fiscal Year Start Date', 'Default Currency'];
|
||||
var msg = 'Please enter the following fields';
|
||||
var flag = 1;
|
||||
for(var i=0; i<lst.length; i++)
|
||||
{
|
||||
if(!d.widgets[lst[i]].value || d.widgets[lst[i]].value=='None'){
|
||||
flag = 0;
|
||||
msg = msg + NEWLINE + lst[i];
|
||||
}
|
||||
}
|
||||
|
||||
if(!flag) alert(msg);
|
||||
return flag;
|
||||
}
|
@ -32,6 +32,9 @@ def execute():
|
||||
reload_doc('utilities', 'page', 'todo')
|
||||
reload_doc('utilities', 'page', 'calendar')
|
||||
reload_doc('utilities', 'page', 'messages')
|
||||
reload_doc('utilities', 'page', 'modules_setup')
|
||||
reload_doc('utilities', 'page', 'users')
|
||||
reload_doc('utilities', 'page', 'activity')
|
||||
|
||||
webnotes.conn.set_value('Control Panel', 'Control Panel', 'home_page',
|
||||
'desktop')
|
||||
|
@ -14,24 +14,14 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
from webnotes.utils import cint, cstr, flt, getdate, now, nowdate
|
||||
from webnotes.model.doc import Document, addchild
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import session, form, msgprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
@ -74,8 +64,9 @@ class DocType:
|
||||
# Account Setup
|
||||
# ---------------
|
||||
def setup_account(self, args):
|
||||
import webnotes
|
||||
company_name, comp_abbr, fy_start, currency, first_name, last_name = eval(args)
|
||||
import webnotes, json
|
||||
locals().update(args)
|
||||
|
||||
curr_fiscal_year, fy_start_date = self.get_fy_details(fy_start)
|
||||
self.currency = currency
|
||||
|
||||
@ -92,7 +83,7 @@ class DocType:
|
||||
|
||||
# Company
|
||||
master_dict = {'Company':{'company_name':company_name,
|
||||
'abbr':comp_abbr,
|
||||
'abbr':company_abbr,
|
||||
'default_currency':currency
|
||||
}}
|
||||
self.create_records(master_dict)
|
||||
@ -117,15 +108,39 @@ class DocType:
|
||||
# Set
|
||||
self.set_defaults(def_args)
|
||||
|
||||
# Set Registration Complete
|
||||
set_default('registration_complete','1')
|
||||
self.create_feed_and_todo()
|
||||
|
||||
msgprint("Great! Your company has now been created")
|
||||
webnotes.clear_cache()
|
||||
msgprint("Company setup is complete")
|
||||
|
||||
import webnotes.utils
|
||||
user_fullname = (first_name or '') + (last_name and (" " + last_name) or '')
|
||||
return {'sys_defaults': webnotes.utils.get_defaults(), 'user_fullname': user_fullname}
|
||||
|
||||
def create_feed_and_todo(self):
|
||||
"""update activty feed and create todo for creation of item, customer, vendor"""
|
||||
import home
|
||||
home.make_feed('Comment', '', '', webnotes.session['user'],
|
||||
'<i>"' + doc.comment + '"</i>', '#6B24B3')
|
||||
|
||||
d = Document('ToDo Item')
|
||||
d.description = 'Create your first <a href="#!List/Customer">Customer</a>'
|
||||
d.priority = 'High'
|
||||
d.date = nowdate()
|
||||
d.save(1)
|
||||
|
||||
d = Document('ToDo Item')
|
||||
d.description = 'Create your first <a href="#!List/Item">Item</a>'
|
||||
d.priority = 'High'
|
||||
d.date = nowdate()
|
||||
d.save(1)
|
||||
|
||||
d = Document('ToDo Item')
|
||||
d.description = 'Create your first <a href="#!List/Supplier">Supplier</a>'
|
||||
d.priority = 'High'
|
||||
d.date = nowdate()
|
||||
d.save(1)
|
||||
|
||||
|
||||
# Get Fiscal year Details
|
||||
# ------------------------
|
||||
@ -209,14 +224,6 @@ class DocType:
|
||||
d.save(1)
|
||||
|
||||
|
||||
# Sync DB
|
||||
# -------
|
||||
def sync_db(arg=''):
|
||||
import webnotes.model.db_schema
|
||||
sql("delete from `tabDocType Update Register`")
|
||||
webnotes.model.db_schema.sync_all()
|
||||
|
||||
|
||||
def is_setup_okay(self, args):
|
||||
"""
|
||||
Validates if setup has been performed after database allocation
|
||||
@ -225,20 +232,13 @@ class DocType:
|
||||
from server_tools.gateway_utils import get_total_users
|
||||
|
||||
args = eval(args)
|
||||
#webnotes.logger.error("args in set_account_details of setup_control: " + str(args))
|
||||
|
||||
cp_defaults = webnotes.conn.get_value('Control Panel', None, 'account_id')
|
||||
|
||||
user_profile = webnotes.conn.get_value('Profile', args['user'], 'name')
|
||||
|
||||
from webnotes.utils import cint
|
||||
|
||||
total_users = get_total_users()
|
||||
|
||||
#webnotes.logger.error("setup_control.is_setup_okay: " + cp_defaults + " " + user_profile + " " + str(total_users))
|
||||
|
||||
#webnotes.logger.error("setup_control.is_setup_okay: Passed Values:" + args['account_name'] + " " + args['user'] + " " + str(args['total_users']))
|
||||
|
||||
if (cp_defaults==args['account_name']) and user_profile and \
|
||||
(total_users==cint(args['total_users'])):
|
||||
return 'True'
|
||||
|
@ -90,6 +90,10 @@ def boot_session(bootinfo):
|
||||
|
||||
bootinfo['modules_list'] = webnotes.conn.get_global('modules_list')
|
||||
|
||||
# if no company, show a dialog box to create a new company
|
||||
bootinfo['setup_complete'] = webnotes.conn.sql("""select name from
|
||||
tabCompany limit 1""") and 'Yes' or 'No'
|
||||
|
||||
def get_letter_heads():
|
||||
"""load letter heads with startup"""
|
||||
import webnotes
|
||||
|
93
erpnext/startup/js/complete_setup.js
Normal file
93
erpnext/startup/js/complete_setup.js
Normal file
@ -0,0 +1,93 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// complete my company registration
|
||||
// --------------------------------
|
||||
|
||||
erpnext.complete_setup = function() {
|
||||
var currency_list = ['', 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AZN',
|
||||
'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BYR',
|
||||
'BZD', 'CAD', 'CDF', 'CFA', 'CFP', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CZK', 'DJF',
|
||||
'DKK', 'DOP', 'DZD', 'EEK', 'EGP', 'ERN', 'ETB', 'EUR', 'EURO', 'FJD', 'FKP', 'FMG', 'GBP',
|
||||
'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GQE', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF',
|
||||
'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF',
|
||||
'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LVL', 'LYD',
|
||||
'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR',
|
||||
'MZM', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NRs', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP',
|
||||
'PKR', 'PLN', 'PYG', 'QAR', 'RMB', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SCR', 'SDG', 'SDR',
|
||||
'SEK', 'SGD', 'SHP', 'SOS', 'SRD', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TRY',
|
||||
'TTD', 'TWD', 'TZS', 'UAE', 'UAH', 'UGX', 'USD', 'USh', 'UYU', 'UZS', 'VEB', 'VND', 'VUV',
|
||||
'WST', 'XAF', 'XCD', 'XDR', 'XOF', 'XPF', 'YEN', 'YER', 'YTL', 'ZAR', 'ZMK', 'ZWR'];
|
||||
|
||||
var d = new wn.widgets.Dialog({
|
||||
title: "Setup",
|
||||
fields: [
|
||||
{fieldname:'first_name', label:'Your First Name', fieldtype:'Data'},
|
||||
{fieldname:'last_name', label:'Your Last Name', fieldtype:'Data'},
|
||||
{fieldname:'company_name', label:'Company Name', fieldtype:'Data', reqd:1,
|
||||
description: 'e.g. "My Company LLC"'},
|
||||
{fieldname:'company_abbr', label:'Company Abbreviation', fieldtype:'Data',
|
||||
description:'e.g. "MC"',reqd:1},
|
||||
{fieldname:'fy_start', label:'Financial Year Start Date', fieldtype:'Select',
|
||||
description:'Your financial year begins on"', reqd:1,
|
||||
options=['', '1st Jan', '1st Apr', '1st Jul', '1st Oct'].join('\n')},
|
||||
{fieldname:'currency': label: 'Default Currency', reqd:1,
|
||||
options=currency_list.join('\n')},
|
||||
{fieldname:'update', label:'Setup',fieldtype:'Button'}
|
||||
]
|
||||
})
|
||||
|
||||
// prepare
|
||||
if(user != 'Administrator'){
|
||||
d.no_cancel(); // Hide close image
|
||||
$('header').toggle(false); // hide toolbar
|
||||
}
|
||||
|
||||
// company name already set
|
||||
if(wn.control_panel.company_name) {
|
||||
var inp = d.fields_dict.company_name.input;
|
||||
inp.value = wn.control_panel.company_name;
|
||||
inp.disabled = true;
|
||||
}
|
||||
|
||||
// set first name, last name
|
||||
if(user_fullname) {
|
||||
u = user_fullname.spilt(' ');
|
||||
if(u[0]) {
|
||||
d.fields_dict.first_name.input.value = u[0];
|
||||
}
|
||||
if(u[1]) {
|
||||
d.fields_dict.last_name.input.value = u[1];
|
||||
}
|
||||
}
|
||||
|
||||
// setup
|
||||
d.fields_dict.update.input.onclick = function() {
|
||||
var data = d.get_values();
|
||||
if(!data) return;
|
||||
$(this).set_working();
|
||||
$c_obj('Setup Control','setup_account',data,function(r, rt){
|
||||
sys_defaults = r.message;
|
||||
user_fullname = r.message.user_fullname;
|
||||
wn.boot.user_fullnames[user] = user_fullname;
|
||||
d.hide();
|
||||
$('header').toggle(true);
|
||||
page_body.wntoolbar.set_user_name();
|
||||
});
|
||||
}
|
||||
|
||||
d.show();
|
||||
}
|
@ -30,7 +30,7 @@ erpnext.modules = {
|
||||
'Website': 'website-home',
|
||||
'HR': 'hr-home',
|
||||
'Setup': 'Setup',
|
||||
'Activity': 'Event Updates',
|
||||
'Activity': 'activity',
|
||||
'To Do': 'todo',
|
||||
'Calendar': 'calendar',
|
||||
'Messages': 'messages',
|
||||
@ -66,6 +66,13 @@ erpnext.startup.start = function() {
|
||||
// ------------------
|
||||
$('footer').html('<div class="web-footer erpnext-footer">\
|
||||
Powered by <a href="https://erpnext.com">ERPNext</a></div>');
|
||||
|
||||
// complete registration
|
||||
if(in_list(user_roles,'System Manager') && (wn.boot.setup_complete=='No')) {
|
||||
wn.require("erpnext/startup/js/complete_setup.js");
|
||||
erpnext.complete_setup();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$('#startup_div').toggle(false);
|
||||
@ -87,28 +94,6 @@ show_chart_browser = function(nm, chart_type){
|
||||
}
|
||||
|
||||
|
||||
// Module Page
|
||||
// ====================================================================
|
||||
|
||||
ModulePage = function(parent, module_name, module_label, help_page, callback) {
|
||||
this.parent = parent;
|
||||
|
||||
// add to current page
|
||||
page_body.cur_page.module_page = this;
|
||||
|
||||
this.wrapper = $a(parent,'div');
|
||||
this.module_name = module_name;
|
||||
this.transactions = [];
|
||||
this.page_head = new PageHeader(this.wrapper, module_label);
|
||||
|
||||
if(help_page) {
|
||||
var btn = this.page_head.add_button('Help', function() { loadpage(this.help_page) }, 1, 'ui-icon-help')
|
||||
btn.help_page = help_page;
|
||||
}
|
||||
|
||||
if(callback) this.callback = function(){ callback(); }
|
||||
}
|
||||
|
||||
// ========== Update Messages ============
|
||||
var update_messages = function() {
|
||||
// Updates Team Messages
|
||||
|
@ -24,5 +24,6 @@ def get_report_list(arg=None):
|
||||
from `tabSearch Criteria`
|
||||
where module='%(module)s'
|
||||
and docstatus in (0, NULL)
|
||||
and ifnull(disabled, 0) = 0
|
||||
order by criteria_name
|
||||
limit %(limit_start)s, %(limit_page_length)s""" % webnotes.form_dict, as_dict=True)
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
753
|
||||
762
|
Loading…
x
Reference in New Issue
Block a user