Merge branch 'latest' of github.com:webnotes/erpnext into latest
This commit is contained in:
commit
7eda1cac27
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,6 +2,8 @@
|
||||
*.comp.js
|
||||
.DS_Store
|
||||
server_tools
|
||||
services
|
||||
user_files
|
||||
patch.log
|
||||
lib
|
||||
versions-local.db
|
||||
|
@ -1,7 +0,0 @@
|
||||
index_path = '/'
|
||||
|
||||
include_paths = [
|
||||
'erpnext',
|
||||
'lib/py',
|
||||
'lib/py/legacy'
|
||||
]
|
@ -2,6 +2,7 @@ import webnotes
|
||||
from webnotes.utils import flt
|
||||
from webnotes.model.code import get_obj
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_default_bank_account():
|
||||
"""
|
||||
Get default bank account for a company
|
||||
@ -14,7 +15,7 @@ def get_default_bank_account():
|
||||
|
||||
if res: return res[0][0]
|
||||
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_new_jv_details():
|
||||
"""
|
||||
Get details which will help create new jv on sales/purchase return
|
||||
|
@ -15,7 +15,7 @@ cur_frm.cscript.account_type = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.account_type(doc, cdt, cdn);
|
||||
// hide India specific fields
|
||||
var cp = locals['Control Panel']['Control Panel'];
|
||||
var cp = wn.control_panel;
|
||||
if(cp.country == 'India')
|
||||
unhide_field(['pan_number', 'tds_applicable', 'tds_details', 'TDS']);
|
||||
else
|
||||
|
@ -1,6 +1,6 @@
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
var cp = locals['Control Panel']['Control Panel'];
|
||||
|
||||
var cp = wn.control_panel;
|
||||
|
||||
if (!doc.voucher_date) doc.voucher_date = dateutil.obj_to_str(new Date());
|
||||
|
||||
if(cp.country == 'India') {
|
||||
@ -11,7 +11,6 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
cur_frm.cscript.load_defaults(doc, cdt, cdn);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,10 +7,10 @@ $import(Purchase Common)
|
||||
// On Load
|
||||
// --------
|
||||
cur_frm.cscript.onload = function(doc,dt,dn) {
|
||||
var cp = locals['Control Panel']['Control Panel'];
|
||||
|
||||
var cp = wn.control_panel;
|
||||
|
||||
if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
|
||||
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
|
||||
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
|
||||
|
||||
if(cp.country == 'India') {
|
||||
unhide_field(['TDS','tds_applicable','tds_category','Get TDS','tax_code','rate','ded_amount','total_tds_on_voucher','tds_amount_on_advance']);
|
||||
|
@ -73,7 +73,7 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
// India related fields
|
||||
var cp = locals['Control Panel']['Control Panel'];
|
||||
var cp = wn.control_panel;
|
||||
if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
|
||||
else hide_field(['c_form_applicable', 'c_form_no']);
|
||||
|
||||
|
@ -11,7 +11,8 @@ from webnotes.utils.scheduler import set_event, cancel_event, Scheduler
|
||||
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
session = webnotes.session
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
@ -1,4 +1,5 @@
|
||||
pscript['onload_Accounts Browser'] = function(){
|
||||
wn.require('lib/js/legacy/widgets/tree.js');
|
||||
// if the user directly loads the page, ask to select the chart
|
||||
var parent = $i('ab_body');
|
||||
parent.innerHTML = 'Please select your chart: '
|
||||
@ -124,7 +125,7 @@ pscript.make_ac_tree = function() {
|
||||
var imgsrc=null;
|
||||
var has_children = true;
|
||||
if(cl[i].group_or_ledger=='Ledger') {
|
||||
var imgsrc = 'lib/images/icons/page.gif';
|
||||
var imgsrc = 'lib/images/icons/page.png';
|
||||
has_children = false;
|
||||
}
|
||||
var t = tree.addNode(n, cl[i].account_name, imgsrc,tree.std_onclick, has_children ? tree.std_onexp : null);
|
||||
@ -137,7 +138,7 @@ pscript.make_ac_tree = function() {
|
||||
var imgsrc=null;
|
||||
var has_children = true;
|
||||
if(cl[i].group_or_ledger=='Ledger') {
|
||||
var imgsrc = 'lib/images/icons/page.gif';
|
||||
var imgsrc = 'lib/images/icons/page.png';
|
||||
has_children = false;
|
||||
}
|
||||
var t = tree.addNode(n, cl[i].cost_center_name, imgsrc,tree.std_onclick, has_children ? tree.std_onexp : null);
|
||||
|
@ -1,6 +1,5 @@
|
||||
<div class="layout_wrapper">
|
||||
<div id="fs_header"></div>
|
||||
</div>
|
||||
<!-- table.statement td { vertical-align: middle; } table.statement td select { width: 100px; } table.stmt_table { table-layout: fixed; border-collapse: collapse; } table.stmt_table td { vertical-align: middle; padding: 2px; } td.stmt_level0 { font-weight: bold; font-size: 14px; border-bottom: 1px solid #AAA; } td.stmt_level1 { font-weight: bold; font-size: 12px; } td.stmt_level2 { font-size: 11px; } td.stmt_level3 { font-size: 11px; } td.stmt_level4 { font-size: 12px; font-weight: bold; border-bottom: 1px solid #000; } td.stmt_level5 { color: BLUE; font-size: 11px; } --> <!--
|
||||
<div style="border: 1px solid #cccccc; padding: 4px; margin-top: 8px; background-color: #eeeeee; width: 98%;">
|
||||
<table class="statement" border="0" cellspacing="2px">
|
||||
@ -25,7 +24,8 @@
|
||||
<div style="margin:10px 0px 10px 0px" mce_style="margin:10px 0px 10px 0px"><button class="button" onclick="pscript.print_statement();">Print</button></div>
|
||||
-->
|
||||
<div id="print_html">
|
||||
<div id="stmt_title1" style="margin:16px 0px 4px 0px; font-size: 16px; font-weight: bold; color: #888;"></div>
|
||||
<div id="stmt_title2" style="margin:0px 0px 8px 0px; font-size: 16px; font-weight: bold;"></div>
|
||||
<div id="stmt_tree" style="margin: 0px 0px 16px; overflow: auto; display: none; width: 100%;"></div>
|
||||
<div id="stmt_title1" style="margin:16px 0px 4px 0px; font-size: 16px; font-weight: bold; color: #888;"></div>
|
||||
<div id="stmt_title2" style="margin:0px 0px 8px 0px; font-size: 16px; font-weight: bold;"></div>
|
||||
<div id="stmt_tree" style="margin: 0px 0px 16px; overflow: auto; display: none; width: 100%;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,3 +0,0 @@
|
||||
# version info
|
||||
|
||||
version='1.0.0'
|
@ -31,26 +31,42 @@ feed_dict = {
|
||||
# Support
|
||||
'Customer Issue': ['[%(status)s] %(description)s by %(customer_name)s', '#000080'],
|
||||
'Maintenance Visit':['To %(customer_name)s', '#4169E1'],
|
||||
'Support Ticket': ['[%(status)s] %(subject)s', '#000080']
|
||||
'Support Ticket': ['[%(status)s] %(subject)s', '#000080'],
|
||||
|
||||
# Website
|
||||
'Web Page': ['%(title)s', '#000080'],
|
||||
'Blog': ['%(title)s', '#000080']
|
||||
}
|
||||
|
||||
def make_feed(doc, subject, color):
|
||||
def make_feed(feedtype, doctype, name, owner, subject, color):
|
||||
"makes a new Feed record"
|
||||
#msgprint(subject)
|
||||
from webnotes.model.doc import Document
|
||||
webnotes.conn.sql("delete from tabFeed where doc_type=%s and doc_name=%s", (doc.doctype, doc.name))
|
||||
from webnotes.utils import get_full_name
|
||||
|
||||
if feedtype in ('Login', 'Comment', 'Assignment'):
|
||||
# delete old login, comment feed
|
||||
webnotes.conn.sql("""delete from tabFeed where
|
||||
datediff(curdate(), creation) > 7 and doc_type in ('Comment', 'Login', 'Assignment')""")
|
||||
else:
|
||||
# one feed per item
|
||||
webnotes.conn.sql("""delete from tabFeed
|
||||
where doc_type=%s and doc_name=%s
|
||||
and ifnull(feed_type,'') != 'Comment'""", (doctype, name))
|
||||
|
||||
f = Document('Feed')
|
||||
f.doc_type = doc.doctype
|
||||
f.doc_name = doc.name
|
||||
f.owner = owner
|
||||
f.feed_type = feedtype
|
||||
f.doc_type = doctype
|
||||
f.doc_name = name
|
||||
f.subject = subject
|
||||
f.color = color
|
||||
f.save(1)
|
||||
f.full_name = get_full_name(owner)
|
||||
f.save()
|
||||
|
||||
def update_feed(doc, method=None):
|
||||
"adds a new feed"
|
||||
if method=='validate':
|
||||
return
|
||||
subject, color = feed_dict.get(doc.doctype, [None, None])
|
||||
if subject:
|
||||
subject = subject % doc.fields
|
||||
make_feed(doc, subject, color)
|
||||
if method=='on_update':
|
||||
subject, color = feed_dict.get(doc.doctype, [None, None])
|
||||
if subject:
|
||||
make_feed('', doc.doctype, doc.name, doc.owner, subject % doc.fields, color)
|
||||
|
@ -3,71 +3,87 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2011-04-08 10:50:41',
|
||||
'creation': '2011-04-06 18:11:38',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-04-05 09:16:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
'modified': '2012-02-08 11:35:40',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': '_FEED.#####',
|
||||
'colour': 'White:FFF',
|
||||
'autoname': u'_FEED.#####',
|
||||
'colour': u'White:FFF',
|
||||
'default_print_format': u'Standard',
|
||||
'doctype': 'DocType',
|
||||
'module': 'Home',
|
||||
'module': u'Home',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'section_style': u'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 1
|
||||
'version': 3
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Data',
|
||||
'doctype': u'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Feed',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'parent': u'Feed',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocType, Feed
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Feed'
|
||||
'name': u'Feed'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'doc_type',
|
||||
'idx': 1,
|
||||
'label': 'Doc Type'
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'feed_type',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Feed Type'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'doc_name',
|
||||
'idx': 2,
|
||||
'label': 'Doc Name'
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'doc_type',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Doc Type'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'subject',
|
||||
'idx': 3,
|
||||
'label': 'Subject'
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'doc_name',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Doc Name'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'color',
|
||||
'idx': 4,
|
||||
'label': 'Color'
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'subject',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Subject'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'color',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Color'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'full_name',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Full Name'
|
||||
}
|
||||
]
|
@ -197,7 +197,10 @@ class DocType:
|
||||
return count
|
||||
|
||||
def get_todo_list(self):
|
||||
return convert_to_lists(sql("select name, description, date, priority,checked from `tabToDo Item` where owner=%s order by field(priority,'High','Medium','Low') asc, date asc", session['user']))
|
||||
return sql("""select name, description, date,
|
||||
priority, checked, reference_type, reference_name from `tabToDo Item`
|
||||
where owner=%s order by field(priority,'High','Medium','Low') asc, date asc""", \
|
||||
session['user'], as_dict=1)
|
||||
|
||||
def add_todo_item(self,args):
|
||||
args = json.loads(args)
|
||||
|
@ -1,6 +1,6 @@
|
||||
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');
|
||||
|
@ -54,11 +54,12 @@ dashboards = [
|
||||
}
|
||||
]
|
||||
|
||||
import webnotes
|
||||
|
||||
class DashboardWidget:
|
||||
def __init__(self, company, start, end, interval):
|
||||
from webnotes.utils import getdate
|
||||
from webnotes.model.code import get_obj
|
||||
import webnotes
|
||||
|
||||
self.company = company
|
||||
self.abbr = webnotes.conn.get_value('Company', company, 'abbr')
|
||||
@ -233,7 +234,7 @@ class DashboardWidget:
|
||||
elif opts['type']=='creation':
|
||||
return self.get_creation_trend(opts['doctype'], start, end)
|
||||
|
||||
|
||||
@webnotes.whitelist()
|
||||
def load_dashboard(args):
|
||||
"""
|
||||
Get dashboard based on
|
||||
|
108
erpnext/home/page/event_updates/complete_registration.js
Normal file
108
erpnext/home/page/event_updates/complete_registration.js
Normal file
@ -0,0 +1,108 @@
|
||||
// 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;
|
||||
}
|
@ -6,7 +6,7 @@ pscript['onload_Event Updates'] = function() {
|
||||
|
||||
pscript.home_make_body();
|
||||
pscript.home_make_status();
|
||||
pscript.home_pre_process();
|
||||
pscript.home_set_banner();
|
||||
pscript.home_make_widgets();
|
||||
}
|
||||
|
||||
@ -30,9 +30,9 @@ pscript.home_make_body = function() {
|
||||
|
||||
// ==================================
|
||||
|
||||
pscript.home_pre_process = function(wrapper) {
|
||||
pscript.home_set_banner = function(wrapper) {
|
||||
var wrapper = page_body.pages['Event Updates'];
|
||||
var cp = locals['Control Panel']['Control Panel'];
|
||||
var cp = wn.control_panel;
|
||||
|
||||
// banner
|
||||
if(cp.client_name) {
|
||||
@ -212,7 +212,8 @@ HomeWidgetItem.prototype.delete_item = function() {
|
||||
var callback = function(r,rt) {
|
||||
$(me.wrapper).slideUp();
|
||||
}
|
||||
$c_obj('Home Control',this.widget.delete_method, this.widget.get_item_id(this.det) ,callback);
|
||||
$c_obj('Home Control',this.widget.delete_method,
|
||||
this.widget.get_item_id(this.det) ,callback);
|
||||
|
||||
}
|
||||
|
||||
@ -324,7 +325,7 @@ HomeToDo = function(widget) {
|
||||
this.widget.get_list_method = 'get_todo_list';
|
||||
this.widget.delete_method = 'remove_todo_item';
|
||||
this.widget.no_items_message = 'Nothing to do?';
|
||||
this.widget.get_item_id = function(det) { return det[0]; }
|
||||
this.widget.get_item_id = function(det) { return det.name; }
|
||||
|
||||
this.widget.decorator = this;
|
||||
|
||||
@ -346,21 +347,32 @@ HomeToDo.prototype.render_item = function(item, det) {
|
||||
$y(tab, {tableLayout:'fixed'});
|
||||
|
||||
var span = $a($td(tab, 0, 0), 'span', '', {padding:'2px',color:'#FFF',fontSize:'10px'
|
||||
,backgroundColor:(det[3]=='Low' ? '#888' : (det[3]=='High' ? '#EDA857' : '#687FD3'))});
|
||||
, backgroundColor:(det.priority=='Low' ? '#888' :
|
||||
(det.priority=='High' ? '#EDA857' : '#687FD3'))});
|
||||
|
||||
$(span).css('-moz-border-radius','3px').css('-webkit-border-radius','3px');
|
||||
span.innerHTML = det[3];
|
||||
span.innerHTML = det.priority;
|
||||
|
||||
// text
|
||||
var span = $a($td(tab, 0, 1), 'span', 'social', {lineHeight:'1.5em'}, replace_newlines(det[1]));
|
||||
if(det[4]) $y(span,{textDecoration:'line-through'});
|
||||
var span = $a($td(tab, 0, 1), 'div', 'social', {lineHeight:'1.5em'},
|
||||
replace_newlines(det.description));
|
||||
if(det.checked) $y(span,{textDecoration:'line-through'});
|
||||
|
||||
// reference link
|
||||
if(det.reference_name) {
|
||||
$a($td(tab, 0, 1), 'div', 'social', '',
|
||||
repl('<a href="#!Form/%(reference_type)s/%(reference_name)s">%(reference_name)s</a>',
|
||||
det))
|
||||
}
|
||||
|
||||
// if expired & open, then in red
|
||||
if(!det[4] && dateutil.str_to_obj(det[2]) < new Date()) {
|
||||
if(!det.checked && dateutil.str_to_obj(det.date) < new Date()) {
|
||||
$y(span,{color:'RED'});
|
||||
$a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'}, dateutil.str_to_user(det[2]) + ' (Overdue)');
|
||||
$a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'},
|
||||
dateutil.str_to_user(det.date) + ' (Overdue)');
|
||||
} else {
|
||||
$a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'}, dateutil.str_to_user(det[2]));
|
||||
$a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'},
|
||||
dateutil.str_to_user(det.date));
|
||||
}
|
||||
}
|
||||
|
||||
@ -371,10 +383,10 @@ HomeToDo.prototype.clear_dialog = function() {
|
||||
HomeToDo.prototype.set_dialog_values = function(det) {
|
||||
var d = this.widget.dialog;
|
||||
d.set_values({
|
||||
date: det[2],
|
||||
priority: det[3],
|
||||
description: det[1],
|
||||
checked: det[4]
|
||||
date: det.date,
|
||||
priority: det.priority,
|
||||
description: det.description,
|
||||
checked: det.checked
|
||||
});
|
||||
d.det = det;
|
||||
}
|
||||
@ -389,8 +401,7 @@ HomeToDo.prototype.save = function(btn) {
|
||||
return;
|
||||
}
|
||||
|
||||
det.name = d.det ? d.det[0] : '';
|
||||
|
||||
det.name = d.det.name;
|
||||
var callback = function(r,rt) {
|
||||
btn.done_working();
|
||||
me.widget.dialog.hide();
|
||||
@ -420,9 +431,6 @@ FeedList.prototype.make_head = function() {
|
||||
// head
|
||||
|
||||
$a(this.head,'h1','', {display:'inline'}, 'Home');
|
||||
$a(this.head,'span','link_type', {marginLeft:'7px', fontSize:'11px'}, 'help', function() {
|
||||
msgprint('<b>What appears here?</b> This is where you get updates of everything you are permitted to follow')
|
||||
})
|
||||
|
||||
// refresh
|
||||
$a(this.head,'span','link_type',
|
||||
@ -442,51 +450,35 @@ FeedList.prototype.run = function() {
|
||||
}
|
||||
|
||||
FeedList.prototype.make_list = function() {
|
||||
this.list_area = $a(this.wrapper,'div')
|
||||
this.no_result = $a(this.wrapper, 'div','help_box',{display:'none'},'Nothing to show yet. Your feed will be updated as you start your activities')
|
||||
|
||||
var l = new Listing('Feed List',1);
|
||||
var me = this;
|
||||
|
||||
// style
|
||||
l.colwidths = ['100%']; l.page_len = 20;
|
||||
l.opts.cell_style = {padding:'0px'};
|
||||
l.opts.hide_rec_label = 1;
|
||||
this.list_area = $a(this.wrapper,'div')
|
||||
|
||||
// build query
|
||||
l.get_query = function(){
|
||||
this.query = repl('select \
|
||||
distinct t1.name, t1.doc_type, t1.doc_name, t1.subject, t1.modified_by, \
|
||||
concat(ifnull(t2.first_name,""), " ", ifnull(t2.last_name,"")), t1.modified, t1.color \
|
||||
from tabFeed t1, tabProfile t2, tabUserRole t3, tabDocPerm t4 \
|
||||
this.list = new wn.widgets.Listing({
|
||||
parent: this.list_area,
|
||||
query: repl('select \
|
||||
distinct t1.name, t1.feed_type, t1.doc_type, t1.doc_name, t1.subject, t1.modified_by, \
|
||||
if(ifnull(t1.full_name,"")="", t1.owner, t1.full_name) as full_name, \
|
||||
t1.modified, t1.color \
|
||||
from tabFeed t1, tabUserRole t3, tabDocPerm t4 \
|
||||
where t1.doc_type = t4.parent \
|
||||
and t2.name = t1.owner \
|
||||
and t3.parent = "%(user)s" \
|
||||
and t4.role = t3.role \
|
||||
and ifnull(t4.`read`,0) = 1 \
|
||||
order by t1.modified desc', {user:user})
|
||||
this.query_max = ''
|
||||
}
|
||||
|
||||
// render list ui
|
||||
l.show_cell = function(cell,ri,ci,d){ me.render_feed(cell,ri,ci,d); }
|
||||
|
||||
// onrun
|
||||
l.onrun = function(){ $(me.wrapper).fadeIn(); if(me.after_run) me.after_run(); }
|
||||
|
||||
// make
|
||||
l.make(this.list_area);
|
||||
$dh(l.btn_area);
|
||||
|
||||
this.list = l;
|
||||
order by t1.modified desc', {user:user}),
|
||||
no_result_message: 'Nothing to show yet. Your feed will be updated as you start your activities',
|
||||
render_row: function(parent, data) {
|
||||
me.render_feed(parent, data)
|
||||
},
|
||||
onrun: function() {
|
||||
$(me.wrapper).fadeIn();
|
||||
if(me.after_run) me.after_run();
|
||||
},
|
||||
hide_refresh: true
|
||||
});
|
||||
}
|
||||
|
||||
FeedList.prototype.after_run = function() {
|
||||
this.list.has_data() ? $dh(this.no_result) : $ds(this.no_result)
|
||||
}
|
||||
|
||||
FeedList.prototype.render_feed = function(cell,ri,ci,d) {
|
||||
new FeedItem(cell, d[ri], this);
|
||||
FeedList.prototype.render_feed = function(parent, data) {
|
||||
new FeedItem(parent, data, this);
|
||||
}
|
||||
|
||||
// Item
|
||||
@ -502,13 +494,11 @@ FeedItem = function(cell, det, feedlist) {
|
||||
this.tab = make_table(this.wrapper, 1, 2, '100%', [(100/7)+'%', (600/7)+'%']);
|
||||
$y(this.tab,{tableLayout:'fixed'})
|
||||
|
||||
// image
|
||||
$y($td(this.tab,0,0),{textAlign:'right',paddingRight:'4px'});
|
||||
|
||||
// text
|
||||
this.text_area = $a($td(this.tab,0,1), 'div');
|
||||
this.render_references(this.text_area, det);
|
||||
|
||||
this.render_references(this.text_area, det);
|
||||
this.render_tag(det);
|
||||
|
||||
// add day separator
|
||||
@ -520,12 +510,12 @@ FeedItem = function(cell, det, feedlist) {
|
||||
|
||||
FeedItem.prototype.add_day_sep = function(det) {
|
||||
var me = this;
|
||||
var prev_date = det[6].split(' ')[0];
|
||||
var prev_date = det.modified.split(' ')[0];
|
||||
|
||||
var make_div = function() {
|
||||
var div = $a(me.head, 'div', '',
|
||||
{borderBottom:'1px solid #888', margin:'8px 0px', padding:'2px 0px', color:'#888', fontSize:'11px'});
|
||||
div.innerHTML = comment_when(det[6], 1);
|
||||
div.innerHTML = comment_when(det.modified, 1);
|
||||
|
||||
// today?
|
||||
if(prev_date==get_today()) {
|
||||
@ -544,35 +534,47 @@ FeedItem.prototype.add_day_sep = function(det) {
|
||||
// -------------------------------------------------
|
||||
|
||||
FeedItem.prototype.render_tag = function(det) {
|
||||
// type is the name
|
||||
tag = $a($td(this.tab,0,0), 'div', '',
|
||||
{color:'#FFF', padding:'3px', textAlign:'right', fontSize:'11px', whiteSpace:'nowrap', overflow:'hidden', cursor:'pointer'});
|
||||
{color:'#FFF', padding:'3px', textAlign:'right', fontSize:'11px',
|
||||
whiteSpace:'nowrap', overflow:'hidden', cursor:'pointer'});
|
||||
$br(tag,'3px');
|
||||
$y(tag, {backgroundColor:(det[7] ? det[7] : '#273')});
|
||||
tag.innerHTML = get_doctype_label(det[1]);
|
||||
tag.dt = det[1]
|
||||
tag.onclick = function() { loaddocbrowser(this.dt); }
|
||||
$y(tag, {backgroundColor:(det.color || '#273')});
|
||||
|
||||
// tag label
|
||||
tag.innerHTML = det.feed_type || get_doctype_label(det.doc_type);
|
||||
|
||||
// not comment / label
|
||||
if(!det.feed_type) {
|
||||
tag.dt = det.doc_type;
|
||||
tag.onclick = function() { loaddocbrowser(this.dt); }
|
||||
}
|
||||
}
|
||||
|
||||
FeedItem.prototype.render_references = function(div, det) {
|
||||
// name
|
||||
div.tab = make_table(div, 1, 2, '100%', [null, '15%'])
|
||||
//div.innerHTML = '<b>' + (strip(det[11]) ? det[11] : det[2]) + ' (' + cint(det[12]) + '): </b> has ' + det[7] + ' ';
|
||||
|
||||
var dt = det[1]; var dn = det[2]
|
||||
div.tab = make_table(div, 1, 2, '100%', [null, '15%'])
|
||||
var dt = det.doc_type; var dn = det.doc_name
|
||||
|
||||
// link
|
||||
var allow = in_list(profile.can_read, dt);
|
||||
var span = $a($td(div.tab,0,0), 'span', (allow ? 'link_type': ''), null, det[2]);
|
||||
span.dt = dt; span.dn = dn;
|
||||
if(allow) span.onclick = function() { loaddoc(this.dt, this.dn); }
|
||||
if(det.feed_type=='Login') {
|
||||
// nothing - no link
|
||||
} else {
|
||||
var allow = in_list(profile.can_read, dt);
|
||||
var span = $a($td(div.tab,0,0), 'span', (allow ? 'link_type': ''), null,
|
||||
det.doc_name);
|
||||
span.dt = dt; span.dn = dn;
|
||||
if(allow) span.onclick = function() { loaddoc(this.dt, this.dn); }
|
||||
}
|
||||
|
||||
// subject
|
||||
if(det[3]) {
|
||||
$a($td(div.tab,0,0), 'span', '', {marginLeft:'7px', color:'#444'}, det[3]);
|
||||
if(det.subject) {
|
||||
$a($td(div.tab,0,0), 'span', '', {marginLeft:'7px', color:'#444'}, det.subject);
|
||||
}
|
||||
|
||||
// by
|
||||
$y($td(div.tab,0,1), {fontSize:'11px'}).innerHTML = (strip(det[5]) ? det[5] : det[4]);
|
||||
$y($td(div.tab,0,1), {fontSize:'11px'}).innerHTML =
|
||||
(strip(det.full_name) ? det.full_name : det.modified_by);
|
||||
}
|
||||
|
||||
HomeStatusBar = function() {
|
||||
@ -583,11 +585,6 @@ HomeStatusBar = function() {
|
||||
|
||||
this.render = function(r) {
|
||||
this.wrapper.innerHTML = '';
|
||||
this.profile_settings = $a($a(this.wrapper, 'p'), 'span', 'link_type', {fontWeight:'bold'});
|
||||
this.profile_settings.innerHTML = user_fullname + ' (Profile Settings)';
|
||||
this.profile_settings.id = "user_fullname";
|
||||
this.profile_settings.onclick = function() { loadpage('profile-settings'); }
|
||||
|
||||
this.span = $a($a(this.wrapper, 'p'), 'span', 'link_type', {fontWeight:'bold'});
|
||||
this.span.onclick = function() { loadpage('My Company') }
|
||||
|
||||
@ -615,6 +612,7 @@ pscript.home_make_status = function() {
|
||||
|
||||
// complete registration
|
||||
if(in_list(user_roles,'System Manager')) {
|
||||
wn.require("erpnext/home/page/event_updates/complete_registration.js");
|
||||
pscript.complete_registration(r.message.registration_complete, r.message.profile);
|
||||
}
|
||||
|
||||
@ -626,114 +624,6 @@ pscript.home_make_status = function() {
|
||||
);
|
||||
}
|
||||
|
||||
// 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
|
||||
$dh(page_body.wntoolbar.wrapper);
|
||||
}
|
||||
|
||||
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(locals['Control Panel']['Control Panel'].company_name) {
|
||||
d.widgets['Company Name'].value = locals['Control Panel']['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.sys_defaults;
|
||||
user_fullname = r.message.user_fullname;
|
||||
d.hide();
|
||||
$ds(page_body.wntoolbar.wrapper);
|
||||
$('#user_fullname').html(user_fullname + " (Profile Settings)");
|
||||
});
|
||||
} 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\n';
|
||||
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;
|
||||
}
|
||||
|
||||
SetupWizard = function(status) {
|
||||
var me = this;
|
||||
$.extend(this, {
|
||||
|
@ -1,7 +1,8 @@
|
||||
import webnotes
|
||||
from webnotes.utils import cint
|
||||
|
||||
def get_online_users():
|
||||
@webnotes.whitelist()
|
||||
def get_online_users(arg=None):
|
||||
# get users
|
||||
return webnotes.conn.sql("""SELECT DISTINCT t1.user, t2.first_name, t2.last_name
|
||||
from tabSessions t1, tabProfile t2
|
||||
@ -9,10 +10,7 @@ def get_online_users():
|
||||
and t1.user not in ('Guest','Administrator')
|
||||
and TIMESTAMPDIFF(HOUR,t1.lastupdate,NOW()) <= 1""", as_list=1) or []
|
||||
|
||||
#
|
||||
# get unread messages
|
||||
#
|
||||
def get_unread_messages():
|
||||
def get_unread_messages(arg=None):
|
||||
"returns unread (docstatus-0 messages for a user)"
|
||||
return cint(webnotes.conn.sql("""SELECT COUNT(*) FROM `tabComment Widget Record`
|
||||
WHERE comment_doctype='My Company'
|
||||
@ -20,10 +18,9 @@ def get_unread_messages():
|
||||
AND ifnull(docstatus,0)=0
|
||||
""", webnotes.user.name)[0][0])
|
||||
|
||||
#
|
||||
# Get toolbar items
|
||||
#
|
||||
@webnotes.whitelist()
|
||||
def get_status_details(arg=None):
|
||||
"""get toolbar items"""
|
||||
from webnotes.utils import cint, date_diff, nowdate, get_defaults
|
||||
|
||||
online = get_online_users()
|
||||
@ -43,7 +40,7 @@ def get_status_details(arg=None):
|
||||
}
|
||||
return ret
|
||||
|
||||
def get_setup_status():
|
||||
def get_setup_status(arg=None):
|
||||
"""
|
||||
Returns the setup status of the current account
|
||||
"""
|
||||
|
@ -43,14 +43,11 @@ pscript.myc_show_erpnext_message = function() {
|
||||
//
|
||||
pscript.myc_add_user = function() {
|
||||
var fields = [{
|
||||
fieldtype: 'Data',
|
||||
fieldname: 'user',
|
||||
reqd: 1,
|
||||
label: 'Email Id of the user to add'
|
||||
}];
|
||||
|
||||
if(!pscript.is_erpnext_saas) {
|
||||
fields = fields.concat([
|
||||
fieldtype: 'Data',
|
||||
fieldname: 'user',
|
||||
reqd: 1,
|
||||
label: 'Email Id of the user to add'
|
||||
},
|
||||
{
|
||||
fieldtype: 'Data',
|
||||
fieldname: 'first_name',
|
||||
@ -67,14 +64,14 @@ pscript.myc_add_user = function() {
|
||||
fieldname: 'password',
|
||||
reqd: 1,
|
||||
label: 'Password'
|
||||
}]);
|
||||
}
|
||||
},
|
||||
{
|
||||
fieldtype: 'Button',
|
||||
label: 'Add',
|
||||
fieldname: 'add'
|
||||
}];
|
||||
|
||||
fields.push({
|
||||
fieldtype: 'Button',
|
||||
label: 'Add',
|
||||
fieldname: 'add'
|
||||
});
|
||||
fields.push();
|
||||
|
||||
var d = new wn.widgets.Dialog({
|
||||
title: 'Add User',
|
||||
@ -246,7 +243,8 @@ MemberItem = function(parent, det, mlist) {
|
||||
// image
|
||||
this.img = $a($td(this.tab,0,0),'img','',{width:'41px'});
|
||||
set_user_img(this.img, det.name, null,
|
||||
(det.file_list ? det.file_list.split(NEWLINE)[0].split(',')[1] : ('no_img_' + (det.gender=='Female' ? 'f' : 'm'))));
|
||||
(det.file_list ? det.file_list.split(NEWLINE)[0].split(',')[1] :
|
||||
('no_img_' + (det.gender=='Female' ? 'f' : 'm'))));
|
||||
}
|
||||
|
||||
// set other details like email id, name etc
|
||||
@ -464,7 +462,7 @@ MemberProfile = function(parent, uid, member_item) {
|
||||
// delete user
|
||||
// create a confirm dialog and call server method
|
||||
this.delete_user = function() {
|
||||
var cp = locals['Control Panel']['Control Panel'];
|
||||
var cp = wn.control_panel;
|
||||
|
||||
var d = new Dialog(400,200,'Delete User');
|
||||
d.make_body([
|
||||
@ -581,7 +579,7 @@ MemberProfile = function(parent, uid, member_item) {
|
||||
$ds(this.member_item.working_img);
|
||||
$dh(this.wrapper);
|
||||
this.loading = 1;
|
||||
$c('webnotes.widgets.form.getdoc', {'name':this.uid, 'doctype':'Profile', 'user':user}, callback); // onload
|
||||
$c('webnotes.widgets.form.load.getdoc', {'name':this.uid, 'doctype':'Profile', 'user':user}, callback); // onload
|
||||
}
|
||||
|
||||
// show / hide
|
||||
@ -860,7 +858,7 @@ RoleObj.prototype.make_label = function(tbl, ridx, cidx, role){
|
||||
|
||||
var t = make_table($td(tbl, ridx, cidx),1,2,null,['16px', null],{marginRight:'5px'});
|
||||
var ic = $a($td(t,0,0), 'img','',{cursor:'pointer', marginRight:'5px'});
|
||||
ic.src= 'lib/images/icons/help.gif';
|
||||
ic.src= 'lib/images/icons/help.png';
|
||||
ic.role = role;
|
||||
|
||||
ic.onclick = function(){
|
||||
|
@ -1,17 +1,17 @@
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cint, load_json, cstr
|
||||
from webnotes.model.doc import Document
|
||||
|
||||
try: import json
|
||||
except: import simplejson as json
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_account_settings_url(arg=''):
|
||||
import server_tools.gateway_utils
|
||||
return server_tools.gateway_utils.get_account_settings_url()
|
||||
|
||||
#
|
||||
# set max users
|
||||
#
|
||||
@webnotes.whitelist()
|
||||
def get_max_users(arg=''):
|
||||
from server_tools.gateway_utils import get_max_users_gateway
|
||||
return {
|
||||
@ -19,16 +19,12 @@ def get_max_users(arg=''):
|
||||
'enabled': cint(webnotes.conn.sql("select count(*) from tabProfile where ifnull(enabled,0)=1 and name not in ('Administrator', 'Guest')")[0][0])
|
||||
}
|
||||
|
||||
#
|
||||
# enable profile in local
|
||||
#
|
||||
@webnotes.whitelist()
|
||||
def enable_profile(arg=''):
|
||||
webnotes.conn.sql("update tabProfile set enabled=1 where name=%s", arg)
|
||||
return 1
|
||||
|
||||
#
|
||||
# disable profile in local
|
||||
#
|
||||
@webnotes.whitelist()
|
||||
def disable_profile(arg=''):
|
||||
if arg=='Administrator':
|
||||
return 'Cannot disable Administrator'
|
||||
@ -37,9 +33,7 @@ def disable_profile(arg=''):
|
||||
webnotes.login_manager.logout(user=arg)
|
||||
return 0
|
||||
|
||||
#
|
||||
# delete user
|
||||
#
|
||||
@webnotes.whitelist()
|
||||
def delete_user(args):
|
||||
args = json.loads(args)
|
||||
webnotes.conn.sql("update tabProfile set enabled=0, docstatus=2 where name=%s", args['user'])
|
||||
@ -51,9 +45,7 @@ def delete_user(args):
|
||||
webnotes.login_manager.logout(user=args['user'])
|
||||
|
||||
|
||||
#
|
||||
# add user
|
||||
#
|
||||
@webnotes.whitelist()
|
||||
def add_user(args):
|
||||
args = json.loads(args)
|
||||
# erpnext-saas
|
||||
@ -63,12 +55,9 @@ def add_user(args):
|
||||
|
||||
add_profile(args)
|
||||
|
||||
#
|
||||
# add profile record
|
||||
#
|
||||
@webnotes.whitelist()
|
||||
def add_profile(args):
|
||||
from webnotes.utils import validate_email_add
|
||||
from webnotes.model.doc import Document
|
||||
from webnotes.utils import validate_email_add, now
|
||||
email = args['user']
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
@ -82,7 +71,7 @@ def add_profile(args):
|
||||
if sql("select name from tabProfile where name = %s", email):
|
||||
# exists, enable it
|
||||
sql("update tabProfile set enabled = 1, docstatus=0 where name = %s", email)
|
||||
webnotes.msgprint('Profile exists, enabled it')
|
||||
webnotes.msgprint('Profile exists, enabled it with new password')
|
||||
else:
|
||||
# does not exist, create it!
|
||||
pr = Document('Profile')
|
||||
@ -94,15 +83,31 @@ def add_profile(args):
|
||||
pr.user_type = 'System User'
|
||||
pr.save(1)
|
||||
|
||||
if args.get('password'):
|
||||
sql("""
|
||||
UPDATE tabProfile
|
||||
SET password = PASSWORD(%s)
|
||||
WHERE name = %s""", (args.get('password'), email))
|
||||
if args.get('password'):
|
||||
sql("""
|
||||
UPDATE tabProfile
|
||||
SET password = PASSWORD(%s), modified = %s
|
||||
WHERE name = %s""", (args.get('password'), now, email))
|
||||
|
||||
send_welcome_mail(email, args)
|
||||
|
||||
@webnotes.whitelist()
|
||||
def send_welcome_mail(email, args):
|
||||
"""send welcome mail to user with password and login url"""
|
||||
pr = Document('Profile', email)
|
||||
from webnotes.utils.email_lib import sendmail_md
|
||||
args.update({
|
||||
'company': webnotes.conn.get_default('company'),
|
||||
'password': args.get('password'),
|
||||
'account_url': webnotes.conn.get_default('account_url')
|
||||
})
|
||||
if not args.get('last_name'): args['last_name'] = ''
|
||||
sendmail_md(pr.email, subject="Welcome to ERPNext", msg=welcome_txt % args)
|
||||
|
||||
#
|
||||
# post comment
|
||||
#
|
||||
@webnotes.whitelist()
|
||||
def post_comment(arg):
|
||||
arg = load_json(arg)
|
||||
|
||||
@ -145,6 +150,7 @@ def post_comment(arg):
|
||||
#
|
||||
# update read messages
|
||||
#
|
||||
@webnotes.whitelist()
|
||||
def set_read_all_messages(arg=''):
|
||||
webnotes.conn.sql("""UPDATE `tabComment Widget Record`
|
||||
SET docstatus = 1
|
||||
@ -152,6 +158,7 @@ def set_read_all_messages(arg=''):
|
||||
AND comment_docname = %s
|
||||
""", webnotes.user.name)
|
||||
|
||||
@webnotes.whitelist()
|
||||
def update_security(args=''):
|
||||
import json
|
||||
args = json.loads(args)
|
||||
@ -168,3 +175,20 @@ def update_security(args=''):
|
||||
else:
|
||||
webnotes.conn.sql("update tabProfile set password=password(%s) where name=%s", (args['new_password'], args['user']))
|
||||
else: webnotes.msgprint('Settings Updated')
|
||||
|
||||
welcome_txt = """
|
||||
## %(company)s
|
||||
|
||||
Dear %(first_name)s %(last_name)s
|
||||
|
||||
Welcome!
|
||||
|
||||
A new account has been created for you, here are your details:
|
||||
|
||||
login-id: %(user)s
|
||||
password: %(password)s
|
||||
|
||||
To login to your new ERPNext account, please go to:
|
||||
|
||||
%(account_url)s
|
||||
"""
|
||||
|
@ -2,29 +2,28 @@ import webnotes
|
||||
|
||||
from webnotes.utils import load_json, cint, nowdate
|
||||
|
||||
@webnotes.whitelist()
|
||||
def change_password(arg):
|
||||
"""
|
||||
Change password
|
||||
"""
|
||||
arg = load_json(arg)
|
||||
|
||||
if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')):
|
||||
import server_tools.gateway_utils
|
||||
webnotes.msgprint(server_tools.gateway_utils.change_password(arg['old_password'], arg['new_password'])['message'])
|
||||
else:
|
||||
if not webnotes.conn.sql('select name from tabProfile where name=%s and password=password(%s)', (webnotes.session['user'], arg['old_password'])):
|
||||
webnotes.msgprint('Old password is not correct', raise_exception=1)
|
||||
if not webnotes.conn.sql('select name from tabProfile where name=%s and password=password(%s)', (webnotes.session['user'], arg['old_password'])):
|
||||
webnotes.msgprint('Old password is not correct', raise_exception=1)
|
||||
|
||||
from webnotes.utils import nowdate
|
||||
webnotes.conn.sql("update tabProfile set password=password(%s) where name=%s",(arg['new_password'], nowdate(), webnotes.session['user']))
|
||||
webnotes.msgprint('Password Updated');
|
||||
from webnotes.utils import nowdate
|
||||
webnotes.conn.sql("update tabProfile set password=password(%s), modified=%s where name=%s",(arg['new_password'], nowdate(), webnotes.session['user']))
|
||||
webnotes.msgprint('Password Updated');
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_user_details(arg=None):
|
||||
"""
|
||||
Returns user first name, last name and bio
|
||||
"""
|
||||
return webnotes.conn.sql("select first_name, last_name, bio from tabProfile where name=%s", webnotes.user.name, as_dict=1)[0]
|
||||
|
||||
@webnotes.whitelist()
|
||||
def set_user_details(arg=None):
|
||||
"""
|
||||
updates user details given in argument
|
||||
@ -39,6 +38,7 @@ def set_user_details(arg=None):
|
||||
p.save()
|
||||
webnotes.msgprint('Updated')
|
||||
|
||||
@webnotes.whitelist()
|
||||
def set_user_image(fid, fname):
|
||||
"""
|
||||
Set uploaded image as user image
|
||||
|
@ -90,8 +90,6 @@ cur_frm.cscript['Declare Completed'] = function(doc,cdt,cdn){
|
||||
|
||||
declare_completed_dialog.refresh_dt = function(){
|
||||
cur_frm.cscript.refresh(this.doc, this.cdt, this.cdn);
|
||||
msgprint("refersh done");
|
||||
$c('webnotes.widgets.form.form_header.refresh_labels',this.doc,function(r,rt){});
|
||||
}
|
||||
|
||||
declare_completed_dialog.add = function() {
|
||||
|
@ -1,19 +1,22 @@
|
||||
import webnotes
|
||||
from webnotes.utils import load_json, cstr, now
|
||||
|
||||
# update the editable text item
|
||||
@webnotes.whitelist()
|
||||
def update_item(args):
|
||||
args = load_json(args)
|
||||
|
||||
webnotes.conn.sql("update `tab%s` set `%s`=%s, modified=%s where name=%s" \
|
||||
% (args['dt'], args['fn'], '%s', '%s', '%s'), (args['text'], now(), args['dn']))
|
||||
|
||||
|
||||
@webnotes.whitelist()
|
||||
def has_answered(arg):
|
||||
return webnotes.conn.sql("select name from tabAnswer where owner=%s and question=%s", (webnotes.user.name, arg)) and 'Yes' or 'No'
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_question(arg):
|
||||
return cstr(webnotes.conn.sql("select question from tabQuestion where name=%s", arg)[0][0])
|
||||
|
||||
@webnotes.whitelist()
|
||||
def add_answer(args):
|
||||
args = load_json(args)
|
||||
|
||||
|
@ -3,6 +3,7 @@ import webnotes
|
||||
from webnotes.utils import load_json, cint, cstr
|
||||
|
||||
# add a new question
|
||||
@webnotes.whitelist()
|
||||
def add_question(arg):
|
||||
args = load_json(arg)
|
||||
|
||||
@ -22,7 +23,7 @@ def add_question(arg):
|
||||
'notify': 1
|
||||
})
|
||||
|
||||
|
||||
@webnotes.whitelist()
|
||||
def vote(arg):
|
||||
args = load_json(arg)
|
||||
|
||||
@ -36,6 +37,7 @@ def vote(arg):
|
||||
|
||||
return p
|
||||
|
||||
@webnotes.whitelist()
|
||||
def delete(arg):
|
||||
"""
|
||||
delete a question or answer (called from kb toolbar)
|
||||
|
2
erpnext/patches/jan_mar_2012/website/__init__.py
Normal file
2
erpnext/patches/jan_mar_2012/website/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
|
12
erpnext/patches/jan_mar_2012/website/all.py
Normal file
12
erpnext/patches/jan_mar_2012/website/all.py
Normal file
@ -0,0 +1,12 @@
|
||||
import patches.jan_mar_2012.website.login
|
||||
import patches.jan_mar_2012.website.feed
|
||||
import patches.jan_mar_2012.website.website
|
||||
import patches.jan_mar_2012.website.cleanups
|
||||
import patches.jan_mar_2012.website.domain_list
|
||||
|
||||
def execute():
|
||||
patches.jan_mar_2012.website.login.execute()
|
||||
patches.jan_mar_2012.website.feed.execute()
|
||||
patches.jan_mar_2012.website.website.execute()
|
||||
patches.jan_mar_2012.website.cleanups.execute()
|
||||
patches.jan_mar_2012.website.domain_list.execute()
|
31
erpnext/patches/jan_mar_2012/website/cleanups.py
Normal file
31
erpnext/patches/jan_mar_2012/website/cleanups.py
Normal file
@ -0,0 +1,31 @@
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
from webnotes.model import delete_doc
|
||||
from webnotes.modules import reload_doc
|
||||
delete_doc("DocType", "SSO Control")
|
||||
delete_doc("DocType", "WN ERP Client Control")
|
||||
delete_doc("DocType", "Production Tips Common")
|
||||
delete_doc("DocType", "DocTrigger")
|
||||
delete_doc("Page", "Setup Wizard")
|
||||
|
||||
# cleanup control panel
|
||||
delete_doc("DocType", "Control Panel")
|
||||
reload_doc("core", "doctype", "control_panel")
|
||||
|
||||
webnotes.conn.sql("""delete from tabSingles
|
||||
where field like 'startup_%' and doctype='Control Panel'""")
|
||||
webnotes.conn.sql("""delete from __SessionCache""")
|
||||
|
||||
webnotes.conn.commit()
|
||||
|
||||
# DDLs
|
||||
# -------------------
|
||||
|
||||
webnotes.conn.sql("drop table if exists tabDocTrigger")
|
||||
|
||||
try: webnotes.conn.sql("""alter table `tabFile Data` drop column blob_content""")
|
||||
except: pass
|
||||
|
||||
webnotes.conn.sql("""alter table __PatchLog engine=InnoDB""")
|
||||
|
22
erpnext/patches/jan_mar_2012/website/domain_list.py
Normal file
22
erpnext/patches/jan_mar_2012/website/domain_list.py
Normal file
@ -0,0 +1,22 @@
|
||||
def execute():
|
||||
import webnotes
|
||||
from webnotes.modules.module_manager import reload_doc
|
||||
reload_doc('website', 'doctype', 'website_settings')
|
||||
|
||||
res = webnotes.conn.sql("""\
|
||||
SELECT name FROM `tabDocPerm`
|
||||
WHERE parent='Website Settings' AND role='All' AND permlevel=1""")
|
||||
if not res:
|
||||
idx = webnotes.conn.sql("""\
|
||||
SELECT MAX(idx) FROM `tabDocPerm`
|
||||
WHERE parent='Website Settings'
|
||||
""")[0][0]
|
||||
from webnotes.model.doc import Document
|
||||
d = Document('DocType', 'Website Settings')
|
||||
perm = d.addchild('permissions', 'DocPerm')
|
||||
perm.read = 1
|
||||
perm.role = 'All'
|
||||
perm.permlevel = 1
|
||||
perm.idx = idx + 1
|
||||
perm.save()
|
||||
|
6
erpnext/patches/jan_mar_2012/website/feed.py
Normal file
6
erpnext/patches/jan_mar_2012/website/feed.py
Normal file
@ -0,0 +1,6 @@
|
||||
import webnotes
|
||||
from webnotes.model.doc import Document
|
||||
from webnotes.modules import reload_doc
|
||||
|
||||
def execute():
|
||||
reload_doc('home', 'doctype', 'feed')
|
19
erpnext/patches/jan_mar_2012/website/login.py
Normal file
19
erpnext/patches/jan_mar_2012/website/login.py
Normal file
@ -0,0 +1,19 @@
|
||||
import webnotes
|
||||
from webnotes.model.doc import Document
|
||||
from webnotes.modules import reload_doc
|
||||
|
||||
def execute():
|
||||
add_default_home_page()
|
||||
reload_doc('setup','doctype','manage_account')
|
||||
|
||||
|
||||
def add_default_home_page():
|
||||
if not webnotes.conn.sql("""select name from `tabDefault Home Page`
|
||||
where role='Guest' and home_page='Login Page'"""):
|
||||
d = Document('Default Home Page')
|
||||
d.parent = 'Control Panel'
|
||||
d.parenttype = 'Control Panel'
|
||||
d.parentfield = 'default_home_pages'
|
||||
d.role = 'Guest'
|
||||
d.home_page = 'Login Page'
|
||||
d.save(1)
|
71
erpnext/patches/jan_mar_2012/website/website.py
Normal file
71
erpnext/patches/jan_mar_2012/website/website.py
Normal file
@ -0,0 +1,71 @@
|
||||
# website patch
|
||||
|
||||
import webnotes
|
||||
from webnotes.model.doc import Document
|
||||
|
||||
def execute():
|
||||
add_website_manager()
|
||||
from webnotes.modules import reload_doc
|
||||
from webnotes.model import delete_doc
|
||||
|
||||
# cleanup page
|
||||
delete_doc("DocType", "Page")
|
||||
reload_doc("core", "doctype", "page")
|
||||
|
||||
reload_doc('setup', 'doctype', 'item_group')
|
||||
delete_doc('Website', 'Module Def', 'Website')
|
||||
reload_doc('website', 'Module Def', 'Website')
|
||||
reload_doc('website', 'Role', 'Website Manager')
|
||||
reload_doc('website', 'Role', 'Blogger')
|
||||
|
||||
webnotes.conn.sql("""delete from `tabModule Def Role` where parent='Website'""")
|
||||
d = Document('Module Def Role')
|
||||
d.parent = 'Website'
|
||||
d.role = 'Website Manager'
|
||||
d.save()
|
||||
|
||||
reload_doc('website', 'doctype', 'about_us_settings')
|
||||
reload_doc('website', 'doctype', 'about_us_team')
|
||||
reload_doc('website', 'doctype', 'blog')
|
||||
reload_doc('website', 'doctype', 'contact_us_settings')
|
||||
reload_doc('website', 'doctype', 'product')
|
||||
reload_doc('website', 'doctype', 'product_group')
|
||||
reload_doc('website', 'doctype', 'products_settings')
|
||||
reload_doc('website', 'doctype', 'related_page')
|
||||
reload_doc('website', 'doctype', 'style_settings')
|
||||
reload_doc('website', 'doctype', 'top_bar_item')
|
||||
reload_doc('website', 'doctype', 'web_page')
|
||||
reload_doc('website', 'doctype', 'website_settings')
|
||||
|
||||
reload_doc('website', 'page', 'about')
|
||||
reload_doc('website', 'page', 'blog')
|
||||
reload_doc('website', 'page', 'contact')
|
||||
reload_doc('website', 'page', 'products')
|
||||
reload_doc('website', 'page', 'unsubscribe')
|
||||
|
||||
create_home_page()
|
||||
|
||||
def create_home_page():
|
||||
"""create a dummy home page"""
|
||||
from webnotes.model.code import get_obj
|
||||
if not webnotes.conn.sql("""select name from `tabWeb Page` where name='home'"""):
|
||||
d = Document('Web Page')
|
||||
d.title = 'Home'
|
||||
d.head_section = "<h1>Your Headline</h1>"
|
||||
d.main_section = "<p>Some introduction about your company</p>"
|
||||
d.side_section = "<p>Links to other pages</p>"
|
||||
d.save()
|
||||
obj = get_obj(doc = d)
|
||||
obj.validate()
|
||||
obj.doc.save()
|
||||
|
||||
def add_website_manager():
|
||||
"""add website manager to system manager"""
|
||||
for i in webnotes.conn.sql("""select distinct parent from tabUserRole
|
||||
where role='System Manager'"""):
|
||||
if not webnotes.conn.sql("""select parent from tabUserRole
|
||||
where role='Website Manager' and parent=%s""", i[0]):
|
||||
d = Document('UserRole')
|
||||
d.parent = i[0]
|
||||
d.role = 'Website Manager'
|
||||
d.save(1)
|
@ -1,4 +1,4 @@
|
||||
<div style="margin:0px">
|
||||
<div class="layout_wrapper">
|
||||
<div id="bom_header"> </div>
|
||||
<!--
|
||||
<div style="color: #444444;" mce_style="color: #444444;">
|
||||
|
@ -1,4 +1,5 @@
|
||||
pscript['onload_Bill of Materials'] = function() {
|
||||
wn.require('lib/js/legacy/widgets/tree.js');
|
||||
|
||||
// header and toolbar
|
||||
var h = new PageHeader('bom_header','Bill of Materials','BOM gives the breakdown of cost for product');
|
||||
@ -113,12 +114,11 @@ pscript.bom_calculate_cost = function() {
|
||||
$c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'calculate_cost', 'arg':pscript.bom_no}, function(r,rt) {
|
||||
var calculated = r.message;
|
||||
if (calculated == 'calculated') {pscript.show_bom();}
|
||||
else {$i('bom_tree').innerHTML = "Sorry it's taking too long try next time....";}
|
||||
else {$i('bom_tree').innerHTML = "Not available";}
|
||||
});
|
||||
}
|
||||
|
||||
pscript.collapse_all = function(){
|
||||
alert("In");
|
||||
pscript.bom_tree.collapseall()
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ GanttChart.prototype.make_date = function(label,idx) {
|
||||
var w = this.make_filter(label,idx);
|
||||
var i = $a(w, 'input');
|
||||
|
||||
var user_fmt = locals['Control Panel']['Control Panel'].date_format;
|
||||
var user_fmt = wn.control_panel.date_format;
|
||||
if(!this.user_fmt)this.user_fmt = 'dd-mm-yy';
|
||||
|
||||
$(i).datepicker({
|
||||
|
@ -1 +0,0 @@
|
||||
<div id="dcv_customers"></div>
|
@ -1,34 +0,0 @@
|
||||
//make tabs
|
||||
|
||||
pscript.onload_customers = function() {
|
||||
make_customer_tab($i('dcv_customers'));
|
||||
}
|
||||
|
||||
function make_customer_tab(parent) {
|
||||
pscript.dcv_customers = new wn.widgets.DocColumnView('Customers', parent,
|
||||
['Customer Group', 'Customer', 'Contact'], {
|
||||
'Customer Group': {
|
||||
show_fields : ['name'],
|
||||
create_fields : ['name'],
|
||||
search_fields : ['name'],
|
||||
next_col: 'Customer'
|
||||
},
|
||||
'Customer': {
|
||||
show_fields : ['name', 'customer_name'],
|
||||
create_fields : ['name', 'customer_name'],
|
||||
search_fields : ['customer_name'],
|
||||
filter_by : ['Customer Group', 'customer_group'],
|
||||
next_col: 'Contact'
|
||||
},
|
||||
'Contact': {
|
||||
show_fields : ['name', 'first_name', 'last_name'],
|
||||
create_fields : ['name','first_name', 'last_name'],
|
||||
search_fields : ['first_name', 'last_name'],
|
||||
conditions: ['is_customer=1'],
|
||||
set_values: {'is_customer': 1 },
|
||||
filter_by : ['Customer', 'customer']
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
[
|
||||
{
|
||||
'content': None,
|
||||
'creation': '2011-03-25 13:48:50',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Page',
|
||||
'icon': None,
|
||||
'idx': None,
|
||||
'menu_index': None,
|
||||
'modified': '2011-03-25 13:48:50',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'CRM',
|
||||
'name': 'customers',
|
||||
'owner': 'Administrator',
|
||||
'page_name': 'Customers',
|
||||
'parent': None,
|
||||
'parent_node': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'script': None,
|
||||
'show_in_menu': None,
|
||||
'standard': 'Yes',
|
||||
'static_content': None,
|
||||
'style': None
|
||||
}
|
||||
]
|
@ -1,4 +1,5 @@
|
||||
pscript['onload_Sales Browser'] = function(){
|
||||
wn.require('lib/js/legacy/widgets/tree.js');
|
||||
var parent = $i('tr_body');
|
||||
parent.innerHTML = 'Please select your chart: '
|
||||
var sel = $a(parent,'select');
|
||||
@ -139,7 +140,7 @@ SalesBrowser.prototype.make_tree = function() {
|
||||
var has_children = true;
|
||||
|
||||
if(cl[i].is_group=='No') {
|
||||
var imgsrc = 'lib/images/icons/page.gif';
|
||||
var imgsrc = 'lib/images/icons/page.png';
|
||||
has_children = false;
|
||||
}
|
||||
var t = me.tree.addNode(n, cl[i].name, imgsrc,me.tree.std_onclick, has_children ? me.tree.std_onexp : null);
|
||||
@ -219,7 +220,7 @@ SalesBrowser.prototype.first_level_node = function(){
|
||||
var has_children = true;
|
||||
|
||||
if(cl[i].is_group=='No') {
|
||||
var imgsrc = 'lib/images/icons/page.gif';
|
||||
var imgsrc = 'lib/images/icons/page.png';
|
||||
has_children = false;
|
||||
}
|
||||
me.tree_area.innerHTML = '';
|
||||
|
@ -5,11 +5,10 @@ pscript['onload_Sales Dashboard'] = function() {
|
||||
$dh(pscript.mnt_div);
|
||||
$dh(pscript.mnt_div1);
|
||||
//pscript.dx_axis = [];
|
||||
|
||||
if($.jqplot) pscript.all_onchnge();
|
||||
else
|
||||
// import the library
|
||||
$c_js('jquery/jquery.jqplot.min.js', pscript.all_onchnge);
|
||||
|
||||
wn.require('lib/css/jqpot.css');
|
||||
wn.require('lib/js/legacy/jquery/jquery.jqplot.min.js');
|
||||
pscript.all_onchnge();
|
||||
}
|
||||
//=======================================================================
|
||||
pscript.make_filters = function(){
|
||||
|
@ -5,52 +5,54 @@
|
||||
{
|
||||
'creation': '2010-08-08 17:09:06',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-12-24 11:58:29',
|
||||
'modified_by': 'abhishek@webnotestech.com',
|
||||
'owner': 'Administrator'
|
||||
'modified': '2012-02-06 17:38:00',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': u'1322549700',
|
||||
'allow_trash': 1,
|
||||
'autoname': 'field:item_group_name',
|
||||
'colour': 'White:FFF',
|
||||
'autoname': u'field:item_group_name',
|
||||
'colour': u'White:FFF',
|
||||
'default_print_format': u'Standard',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'document_type': u'Master',
|
||||
'in_create': 1,
|
||||
'issingle': 0,
|
||||
'module': 'Setup',
|
||||
'module': u'Setup',
|
||||
'name': '__common__',
|
||||
'search_fields': 'parent_item_group',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'search_fields': u'parent_item_group',
|
||||
'section_style': u'Simple',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 54
|
||||
'version': 58
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'doctype': u'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Item Group',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
'parent': u'Item Group',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'doctype': u'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Item Group',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'parent': u'Item Group',
|
||||
'parentfield': u'permissions',
|
||||
'parenttype': u'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Item Group
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Item Group'
|
||||
'name': u'Item Group'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
@ -58,10 +60,9 @@
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': 'Material Manager',
|
||||
'role': u'Material Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
@ -71,10 +72,9 @@
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': 'Material Manager',
|
||||
'role': u'Material Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
@ -84,10 +84,9 @@
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': 'Material User',
|
||||
'role': u'Material User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
@ -97,10 +96,9 @@
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': 'Material User',
|
||||
'role': u'Material User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
@ -109,10 +107,9 @@
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 5,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': 'System Manager',
|
||||
'role': u'System Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
@ -120,106 +117,98 @@
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 6,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': 'Material Master Manager',
|
||||
'role': u'Material Master Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'trash_reason',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 1,
|
||||
'label': 'Trash Reason',
|
||||
'oldfieldname': 'trash_reason',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_group_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Item Group Name',
|
||||
'oldfieldname': 'item_group_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'item_group_name',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Item Group Name',
|
||||
'oldfieldname': u'item_group_name',
|
||||
'oldfieldtype': u'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'show_in_catalogue',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 3,
|
||||
'label': 'Show in catalogue',
|
||||
'oldfieldname': 'show_in_catalogue',
|
||||
'oldfieldtype': 'Check',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'description',
|
||||
'fieldtype': u'Text',
|
||||
'label': u'Description',
|
||||
'oldfieldname': u'description',
|
||||
'oldfieldtype': u'Text',
|
||||
'permlevel': 0,
|
||||
'width': u'300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Check this if you want to show in website',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'show_in_website',
|
||||
'fieldtype': u'Check',
|
||||
'label': u'Show in Website',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 4,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 0,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'parent_item_group',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 5,
|
||||
'label': 'Parent Item Group',
|
||||
'oldfieldname': 'parent_item_group',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item Group',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'parent_item_group',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Parent Item Group',
|
||||
'oldfieldname': u'parent_item_group',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Item Group',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Only leaf nodes are allowed in transaction',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'is_group',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 6,
|
||||
'label': 'Has Child Node',
|
||||
'oldfieldname': 'is_group',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nYes\nNo',
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Only leaf nodes are allowed in transaction',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'is_group',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Has Child Node',
|
||||
'oldfieldname': u'is_group',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'\nYes\nNo',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'lft',
|
||||
'fieldtype': 'Int',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'trash_reason',
|
||||
'fieldtype': u'Small Text',
|
||||
'label': u'Trash Reason',
|
||||
'oldfieldname': u'trash_reason',
|
||||
'oldfieldtype': u'Small Text',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'lft',
|
||||
'fieldtype': u'Int',
|
||||
'hidden': 1,
|
||||
'idx': 7,
|
||||
'in_filter': 1,
|
||||
'label': 'lft',
|
||||
'label': u'lft',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'lft',
|
||||
'oldfieldtype': 'Int',
|
||||
'oldfieldname': u'lft',
|
||||
'oldfieldtype': u'Int',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 0,
|
||||
@ -228,16 +217,15 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rgt',
|
||||
'fieldtype': 'Int',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'rgt',
|
||||
'fieldtype': u'Int',
|
||||
'hidden': 1,
|
||||
'idx': 8,
|
||||
'in_filter': 1,
|
||||
'label': 'rgt',
|
||||
'label': u'rgt',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'rgt',
|
||||
'oldfieldtype': 'Int',
|
||||
'oldfieldname': u'rgt',
|
||||
'oldfieldtype': u'Int',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 0,
|
||||
@ -246,17 +234,17 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'old_parent',
|
||||
'fieldtype': 'Data',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'old_parent',
|
||||
'fieldtype': u'Link',
|
||||
'hidden': 1,
|
||||
'idx': 9,
|
||||
'label': 'old_parent',
|
||||
'label': u'old_parent',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'old_parent',
|
||||
'oldfieldtype': 'Data',
|
||||
'oldfieldname': u'old_parent',
|
||||
'oldfieldtype': u'Data',
|
||||
'options': u'Item Group',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
}
|
||||
]
|
||||
]
|
||||
|
@ -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;
|
||||
});
|
||||
}
|
@ -1,66 +1,53 @@
|
||||
# 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 on_update(self):
|
||||
"""update defaults"""
|
||||
|
||||
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()
|
@ -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
|
||||
@ -102,6 +101,37 @@
|
||||
'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
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
@ -173,14 +203,6 @@
|
||||
'label': 'Default Currency Fraction'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sms_sender_name',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'SMS Sender Name'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
@ -510,4 +532,4 @@
|
||||
'label': 'Employee Records to be created by ',
|
||||
'options': '\nNaming Series\nEmployee Number'
|
||||
}
|
||||
]
|
||||
]
|
@ -6,7 +6,7 @@ cur_frm.cscript.select_transaction = function(doc, dt, dn) {
|
||||
refresh_field('custom_message');
|
||||
}
|
||||
$c_obj('Notification Control','get_message',doc.select_transaction, callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.notify = function(doc, args) {
|
||||
|
@ -35,13 +35,24 @@ class DocType:
|
||||
# set account details
|
||||
#-----------------------
|
||||
def set_account_details(self, args):
|
||||
args = eval(args)
|
||||
"""
|
||||
Called from gateway after allocation
|
||||
"""
|
||||
import json
|
||||
args = json.loads(args)
|
||||
|
||||
self.set_cp_defaults(args['company'], args['industry'], args['time_zone'], args['country'], args['account_name'])
|
||||
self.create_profile(args['user'], args['first_name'], args['last_name'])
|
||||
|
||||
from server_tools.gateway_utils import update_client_control
|
||||
update_client_control(args['total_users'])
|
||||
# Domain related updates
|
||||
try:
|
||||
from server_tools.gateway_utils import add_domain_map
|
||||
add_domain_map(args)
|
||||
except ImportError, e:
|
||||
pass
|
||||
|
||||
# add record in domain_list of Website Settings
|
||||
webnotes.conn.set_value('Website Settings', 'Website Settings', 'subdomain', args['url_name'] + ".erpnext.com")
|
||||
|
||||
|
||||
# Account Setup
|
||||
@ -140,7 +151,7 @@ class DocType:
|
||||
for d in def_args.keys():
|
||||
ma_obj.doc.fields[d] = def_args[d]
|
||||
ma_obj.doc.save()
|
||||
ma_obj.update_cp()
|
||||
ma_obj.on_update()
|
||||
|
||||
|
||||
# Set Control Panel Defaults
|
||||
|
@ -1 +0,0 @@
|
||||
<div id="crm_home"></div>
|
@ -1,32 +0,0 @@
|
||||
//make tabs
|
||||
|
||||
pscript.onload_people = function() {
|
||||
make_customer_tab($i('crm_home'));
|
||||
}
|
||||
|
||||
function make_customer_tab(parent) {
|
||||
new wn.widgets.DocColumnView('Customers', parent, ['Customer Group', 'Customer', 'Contact'], {
|
||||
'Customer Group': {
|
||||
show_fields : ['name'],
|
||||
create_fields : ['name'],
|
||||
search_fields : ['name'],
|
||||
next_col: 'Customer'
|
||||
},
|
||||
'Customer': {
|
||||
show_fields : ['name', 'customer_name'],
|
||||
create_fields : ['name', 'customer_name'],
|
||||
search_fields : ['customer_name'],
|
||||
filter_by : ['Customer Group', 'customer_group'],
|
||||
next_col: 'Contact'
|
||||
},
|
||||
'Contact': {
|
||||
show_fields : ['name', 'first_name', 'last_name'],
|
||||
create_fields : ['name','first_name', 'last_name'],
|
||||
search_fields : ['first_name', 'last_name'],
|
||||
conditions: ['is_customer=1'],
|
||||
filter_by : ['Customer', 'customer']
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
[
|
||||
{
|
||||
'content': None,
|
||||
'creation': '2011-03-21 12:12:32',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Page',
|
||||
'icon': None,
|
||||
'idx': None,
|
||||
'menu_index': None,
|
||||
'modified': '2011-03-21 12:13:39',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Setup',
|
||||
'name': 'people',
|
||||
'owner': 'Administrator',
|
||||
'page_name': 'People',
|
||||
'parent': None,
|
||||
'parent_node': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'script': None,
|
||||
'show_in_menu': None,
|
||||
'standard': 'Yes',
|
||||
'static_content': None,
|
||||
'style': None
|
||||
}
|
||||
]
|
@ -1 +1,3 @@
|
||||
<div id="setup_div" class="layout_wrapper"></div>
|
||||
<div id="setup_div" class="layout_wrapper">
|
||||
<div style="margin: 200px auto; text-align: center; color: #888">Loading...</div>
|
||||
</div>
|
@ -1,9 +1,8 @@
|
||||
pscript.onload_Setup = function() {
|
||||
var parent = $i('setup_div');
|
||||
add_space_holder(parent);
|
||||
|
||||
var callback = function(r,rt){
|
||||
|
||||
$('#setup_div').empty();
|
||||
// header
|
||||
parent.page_head = new PageHeader(parent,'Setup');
|
||||
|
||||
@ -11,7 +10,6 @@ pscript.onload_Setup = function() {
|
||||
var setup_data = new SetupData(r.message);
|
||||
pscript.setup_make_sections(setup_data);
|
||||
|
||||
remove_space_holder();
|
||||
}
|
||||
$c_obj('Setup Wizard Control','get_country','',callback);
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
# Module Def, Setup Masters
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:35:42',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-23 17:04:53',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Module Def
|
||||
{
|
||||
'disabled': 'No',
|
||||
'doctype': u'Module Def',
|
||||
'is_hidden': 'No',
|
||||
'last_updated_date': '2010-11-29 12:02:02',
|
||||
'module_label': 'Setup Masters',
|
||||
'module_name': 'Setup Masters',
|
||||
'name': '__common__'
|
||||
},
|
||||
|
||||
# Module Def, Setup Masters
|
||||
{
|
||||
'doctype': u'Module Def',
|
||||
'name': 'Setup Masters'
|
||||
}
|
||||
]
|
@ -1,103 +1,67 @@
|
||||
import webnotes
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
import home
|
||||
|
||||
#
|
||||
# alias the current user
|
||||
#
|
||||
def on_login(login_manager):
|
||||
|
||||
# login as
|
||||
if login_manager.user == 'Administrator':
|
||||
user = webnotes.form.getvalue('login_as')
|
||||
|
||||
if user:
|
||||
# create if missing (due to some bug)
|
||||
login_as(user, login_manager)
|
||||
|
||||
# alisaing here... so check if the user is disabled
|
||||
if not webnotes.conn.sql("select ifnull(enabled,0) from tabProfile where name=%s", user)[0][0]:
|
||||
# throw execption
|
||||
webnotes.msgprint("Authentication Failed", raise_exception=1)
|
||||
|
||||
if hasattr(webnotes.defs, 'validate_ip'):
|
||||
msg = getattr(webnotes.defs, 'validate_ip')()
|
||||
if msg: webnotes.msgprint(msg, raise_exception=1)
|
||||
|
||||
login_manager.user = user
|
||||
|
||||
#
|
||||
# update account details
|
||||
#
|
||||
def update_account_details():
|
||||
# additional details (if from gateway)
|
||||
if webnotes.form_dict.get('is_trial'):
|
||||
webnotes.conn.set_global('is_trial', cint(webnotes.form_dict.get('is_trial')))
|
||||
|
||||
if webnotes.form_dict.get('days_to_expiry'):
|
||||
webnotes.conn.set_global('days_to_expiry', webnotes.form_dict.get('days_to_expiry'))
|
||||
|
||||
if webnotes.form_dict.get('first_name'):
|
||||
from server_tools.gateway_utils import update_user_details
|
||||
update_user_details()
|
||||
"""
|
||||
called from login manager, before login
|
||||
"""
|
||||
if login_manager.user not in ('Guest', None, ''):
|
||||
try:
|
||||
import server_tools.gateway_utils
|
||||
server_tools.gateway_utils.check_login(login_manager.user)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
#
|
||||
# save (login from)
|
||||
#
|
||||
def on_login_post_session(login_manager):
|
||||
# login from
|
||||
if webnotes.form_dict.get('login_from'):
|
||||
webnotes.session['data']['login_from'] = webnotes.form.getvalue('login_from')
|
||||
webnotes.session_obj.update()
|
||||
|
||||
"""
|
||||
called after login
|
||||
update login_from and delete parallel sessions
|
||||
"""
|
||||
# Clear previous sessions i.e. logout previous log-in attempts
|
||||
exception_list = ['demo@webnotestech.com', 'Administrator']
|
||||
exception_list = ['demo@webnotestech.com', 'Administrator', 'Guest']
|
||||
if webnotes.session['user'] not in exception_list:
|
||||
sid_list = webnotes.conn.sql("""
|
||||
SELECT sid
|
||||
FROM `tabSessions`
|
||||
DELETE FROM `tabSessions`
|
||||
WHERE
|
||||
user=%s AND
|
||||
sid!=%s
|
||||
ORDER BY lastupdate desc""", \
|
||||
sid!=%s""", \
|
||||
(webnotes.session['user'], webnotes.session['sid']), as_list=1)
|
||||
for sid in sid_list:
|
||||
webnotes.conn.sql("DELETE FROM `tabSessions` WHERE sid=%s", sid[0])
|
||||
|
||||
update_account_details()
|
||||
if webnotes.session['user'] not in ('Guest'):
|
||||
# create feed
|
||||
from webnotes.utils import nowtime
|
||||
home.make_feed('Login', 'Profile', login_manager.user, login_manager.user,
|
||||
'%s logged in at %s' % (login_manager.user_fullname, nowtime()),
|
||||
login_manager.user=='Administrator' and '#8CA2B3' or '#1B750D')
|
||||
|
||||
#
|
||||
# logout the user from SSO
|
||||
#
|
||||
def on_logout(login_manager):
|
||||
if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
|
||||
from server_tools.gateway_utils import logout_sso
|
||||
logout_sso(user=login_manager.user)
|
||||
def comment_added(doc):
|
||||
"""add comment to feed"""
|
||||
home.make_feed('Comment', doc.comment_doctype, doc.comment_docname, doc.comment_by,
|
||||
'<i>"' + doc.comment + '"</i>', '#6B24B3')
|
||||
|
||||
#
|
||||
# create a profile (if logs in for the first time)
|
||||
#
|
||||
def login_as(user, login_manager):
|
||||
import os
|
||||
def doclist_all(doc, method):
|
||||
"""doclist trigger called from webnotes.model.doclist on any event"""
|
||||
home.update_feed(doc, method)
|
||||
|
||||
def boot_session(bootinfo):
|
||||
"""boot session - send website info if guest"""
|
||||
import webnotes
|
||||
webnotes.session = {'user': user}
|
||||
ip = os.environ.get('REMOTE_ADDR')
|
||||
import webnotes.model.doc
|
||||
|
||||
if webnotes.session['user']=='Guest':
|
||||
bootinfo['website_settings'] = webnotes.model.doc.getsingle('Website Settings')
|
||||
bootinfo['website_menus'] = webnotes.conn.sql("""select label, url, custom_page,
|
||||
parent_label, parentfield
|
||||
from `tabTop Bar Item` where parent='Website Settings' order by idx asc""", as_dict=1)
|
||||
bootinfo['custom_css'] = webnotes.conn.get_value('Style Settings', None, 'custom_css') or ''
|
||||
else:
|
||||
bootinfo['letter_heads'] = get_letter_heads()
|
||||
|
||||
# validate if user is from SSO
|
||||
if ip == '72.55.168.105' or 1:
|
||||
# if user does not exist, create it
|
||||
if not webnotes.conn.sql("select name from tabProfile where name=%s", user):
|
||||
from webnotes.model.doc import Document
|
||||
|
||||
import webnotes
|
||||
import webnotes.utils.webservice
|
||||
|
||||
p = Document('Profile')
|
||||
p.first_name = webnotes.form_dict.get('first_name')
|
||||
p.last_name = webnotes.form_dict.get('last_name')
|
||||
p.email = user
|
||||
p.name = user
|
||||
p.enabled = 1
|
||||
p.owner = user
|
||||
p.save(1)
|
||||
|
||||
def get_letter_heads():
|
||||
"""load letter heads with startup"""
|
||||
import webnotes
|
||||
ret = webnotes.conn.sql("""select name, content from `tabLetter Head`
|
||||
where ifnull(disabled,0)=0""")
|
||||
return dict(ret)
|
||||
|
187
erpnext/startup/feature_setup.js
Normal file
187
erpnext/startup/feature_setup.js
Normal file
@ -0,0 +1,187 @@
|
||||
/* features setup "Dictionary", "Script"
|
||||
Dictionary Format
|
||||
'projects': {
|
||||
'Sales Order': {
|
||||
'fields':['project_name'],
|
||||
'sales_order_details':['projected_qty']
|
||||
},
|
||||
'Purchase Order': {
|
||||
'fields':['project_name']
|
||||
}
|
||||
}
|
||||
// ====================================================================*/
|
||||
pscript.feature_dict = {
|
||||
'fs_projects': {
|
||||
'Bill Of Materials': {'fields':['project_name']},
|
||||
'Delivery Note': {'fields':['project_name']},
|
||||
'Payable Voucher': {'fields':['project_name']},
|
||||
'Production Order': {'fields':['project_name']},
|
||||
'Purchase Order': {'fields':['project_name']},
|
||||
'Purchase Receipt': {'fields':['project_name']},
|
||||
'Receivable Voucher': {'fields':['project_name']},
|
||||
'Sales Order': {'fields':['project_name']},
|
||||
'Stock Entry': {'fields':['project_name']},
|
||||
'Timesheet': {'timesheet_details':['project_name']}
|
||||
},
|
||||
'fs_packing_details': {
|
||||
'Delivery Note': {'fields':['packing_details','print_packing_slip','packing_checked_by','packed_by','pack_size','shipping_mark'],'delivery_note_details':['no_of_packs','pack_gross_wt','pack_nett_wt','pack_no','pack_unit']},
|
||||
'Sales Order': {'fields':['packing_details']}
|
||||
},
|
||||
'fs_discounts': {
|
||||
'Delivery Note': {'delivery_note_details':['adj_rate']},
|
||||
'Quotation': {'quotation_details':['adj_rate']},
|
||||
'Receivable Voucher': {'entries':['adj_rate']},
|
||||
'Sales Order': {'sales_order_details':['adj_rate','ref_rate']}
|
||||
},
|
||||
'fs_purchase_discounts': {
|
||||
'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
|
||||
'Payable Voucher': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}
|
||||
},
|
||||
'fs_brands': {
|
||||
'Delivery Note': {'delivery_note_details':['brand']},
|
||||
'Indent': {'indent_details':['brand']},
|
||||
'Item': {'fields':['brand']},
|
||||
'Purchase Order': {'po_details':['brand']},
|
||||
'Payable Voucher': {'entries':['brand']},
|
||||
'Quotation': {'quotation_details':['brand']},
|
||||
'Receivable Voucher': {'entries':['brand']},
|
||||
'Sales BOM': {'fields':['new_item_brand']},
|
||||
'Sales Order': {'sales_order_details':['brand']},
|
||||
'Serial No': {'fields':['brand']}
|
||||
},
|
||||
'fs_after_sales_installations': {
|
||||
'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']}
|
||||
},
|
||||
'fs_item_batch_nos': {
|
||||
'Delivery Note': {'delivery_note_details':['batch_no']},
|
||||
'Item': {'fields':['has_batch_no']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['batch_no']},
|
||||
'QA Inspection Report': {'fields':['batch_no']},
|
||||
'Sales and Pruchase Return Wizard': {'return_details':['batch_no']},
|
||||
'Receivable Voucher': {'entries':['batch_no']},
|
||||
'Stock Entry': {'mtn_details':['batch_no']},
|
||||
'Stock Ledger Entry': {'fields':['batch_no']}
|
||||
},
|
||||
'fs_item_serial_nos': {
|
||||
'Customer Issue': {'fields':['serial_no']},
|
||||
'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']},
|
||||
'Installation Note': {'installed_item_details':['serial_no']},
|
||||
'Item': {'fields':['has_serial_no']},
|
||||
'Maintenance Schedule': {'item_maintenance_details':['serial_no'],'maintenance_schedule_details':['serial_no']},
|
||||
'Maintenance Visit': {'maintenance_visit_details':['serial_no']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['serial_no']},
|
||||
'QA Inspection Report': {'fields':['item_serial_no']},
|
||||
'Sales and Pruchase Return Wizard': {'return_details':['serial_no']},
|
||||
'Receivable Voucher': {'entries':['serial_no']},
|
||||
'Stock Entry': {'mtn_details':['serial_no']},
|
||||
'Stock Ledger Entry': {'fields':['serial_no']}
|
||||
},
|
||||
'fs_item_group_in_details': {
|
||||
'Delivery Note': {'delivery_note_details':['item_group']},
|
||||
'Enquiry': {'enquiry_details':['item_group']},
|
||||
'Indent': {'indent_details':['item_group']},
|
||||
'Item': {'fields':['item_group']},
|
||||
'Manage Account': {'fields':['default_item_group']},
|
||||
'Purchase Order': {'po_details':['item_group']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['item_group']},
|
||||
'Purchase Voucher': {'entries':['item_group']},
|
||||
'Quotation': {'quotation_details':['item_group']},
|
||||
'Receivable Voucher': {'entries':['item_group']},
|
||||
'Sales BOM': {'fields':['serial_no']},
|
||||
'Sales Order': {'sales_order_details':['item_group']},
|
||||
'Serial No': {'fields':['item_group']},
|
||||
'Sales Partner': {'partner_target_details':['item_group']},
|
||||
'Sales Person': {'target_details':['item_group']},
|
||||
'Territory': {'target_details':['item_group']}
|
||||
},
|
||||
'fs_page_break': {
|
||||
'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']},
|
||||
'Indent': {'indent_details':['page_break']},
|
||||
'Purchase Order': {'po_details':['page_break']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['page_break']},
|
||||
'Purchase Voucher': {'entries':['page_break']},
|
||||
'Quotation': {'quotation_details':['page_break']},
|
||||
'Receivable Voucher': {'entries':['page_break']},
|
||||
'Sales Order': {'sales_order_details':['page_break']}
|
||||
},
|
||||
'fs_exports': {
|
||||
'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']},
|
||||
'POS Setting': {'fields':['conversion_rate','currency']},
|
||||
'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']},
|
||||
'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','export_amount','export_rate']},
|
||||
'Item': {'ref_rate_details':['ref_currency']},
|
||||
'Sales BOM': {'fields':['currency']},
|
||||
'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']}
|
||||
},
|
||||
'fs_imports': {
|
||||
'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']},
|
||||
'Purchase Order': {'fields':['Note HTML','conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'po_details':['import_amount','import_rate']},
|
||||
'Purchase Receipt': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'purchase_receipt_details':['import_amount','import_rate']},
|
||||
'Supplier Quotation': {'fields':['conversion_rate','currency']}
|
||||
},
|
||||
'fs_item_advanced': {
|
||||
'Item': {'fields':['item_customer_details']}
|
||||
},
|
||||
'fs_sales_extras': {
|
||||
'Address': {'fields':['sales_partner']},
|
||||
'Contact': {'fields':['sales_partner']},
|
||||
'Customer': {'fields':['sales_team']},
|
||||
'Delivery Note': {'fields':['sales_team','Packing List']},
|
||||
'Item': {'fields':['item_customer_details']},
|
||||
'Receivable Voucher': {'fields':['sales_team']},
|
||||
'Sales Order': {'fields':['sales_team','Packing List']}
|
||||
},
|
||||
'fs_more_info': {
|
||||
'Customer': {'fields':['More Info']},
|
||||
'Delivery Note': {'fields':['More Info']},
|
||||
'Enquiry': {'fields':['More Info']},
|
||||
'Indent': {'fields':['More Info']},
|
||||
'Lead': {'fields':['More Info']},
|
||||
'Payable Voucher': {'fields':['More Info']},
|
||||
'Purchase Order': {'fields':['More Info']},
|
||||
'Purchase Receipt': {'fields':['More Info']},
|
||||
'Quotation': {'fields':['More Info']},
|
||||
'Receivable Voucher': {'fields':['More Info']},
|
||||
'Sales Order': {'fields':['More Info']},
|
||||
'Serial No': {'fields':['More Info']},
|
||||
'Supplier': {'fields':['More Info']}
|
||||
},
|
||||
'fs_quality': {
|
||||
'Item': {'fields':['Item Inspection Criteria','inspection_required']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['qa_no']}
|
||||
},
|
||||
'fs_manufacturing': {
|
||||
'Item': {'fields':['Manufacturing']}
|
||||
},
|
||||
'fs_pos': {
|
||||
'Receivable Voucher': {'fields':['is_pos']}
|
||||
},
|
||||
'fs_recurring_invoice': {
|
||||
'Receivable Voucher': {'fields': ['Recurring Invoice']}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).bind('form_refresh', function() {
|
||||
for(sys_feat in sys_defaults)
|
||||
{
|
||||
if(sys_defaults[sys_feat]=='0' && (sys_feat in pscript.feature_dict)) //"Features to hide" exists
|
||||
{
|
||||
if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat])
|
||||
{
|
||||
for(fort in pscript.feature_dict[sys_feat][cur_frm.doc.doctype])
|
||||
{
|
||||
if(fort=='fields')
|
||||
hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]);
|
||||
else if(cur_frm.fields_dict[fort])
|
||||
{
|
||||
for(grid_field in pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort])
|
||||
cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort][grid_field], false);
|
||||
}
|
||||
else
|
||||
msgprint('Grid "'+fort+'" does not exists');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
350
erpnext/startup/modules.js
Normal file
350
erpnext/startup/modules.js
Normal file
@ -0,0 +1,350 @@
|
||||
// ====================================================================
|
||||
|
||||
pscript.startup_make_sidebar = function() {
|
||||
$y(page_body.left_sidebar, {width:(100/6)+'%', paddingTop:'8px'});
|
||||
|
||||
var callback = function(r,rt) {
|
||||
// menu
|
||||
var ml = r.message;
|
||||
|
||||
// clear
|
||||
page_body.left_sidebar.innerHTML = '';
|
||||
|
||||
for(var m=0; m<ml.length; m++){
|
||||
if(ml[m]) {
|
||||
new SidebarItem(ml[m]);
|
||||
}
|
||||
}
|
||||
nav_obj.observers.push({notify:function(t,dt,dn) { pscript.select_sidebar_menu(t, dt, dn); }});
|
||||
|
||||
// select current
|
||||
var no = nav_obj.ol[nav_obj.ol.length-1];
|
||||
if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
|
||||
pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
|
||||
}
|
||||
$c_obj('Home Control', 'get_modules', '', callback);
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// Menu observer
|
||||
// ====================================================================
|
||||
|
||||
cur_menu_pointer = null;
|
||||
var menu_item_map = {'Form':{}, 'Page':{}, 'Report':{}, 'List':{}}
|
||||
|
||||
pscript.select_sidebar_menu = function(t, dt, dn) {
|
||||
// get menu item
|
||||
if(menu_item_map[t][dt]) {
|
||||
// select
|
||||
menu_item_map[t][dt].select();
|
||||
} else {
|
||||
// none found :-( Unselect
|
||||
if(cur_menu_pointer)
|
||||
cur_menu_pointer.deselect();
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// Menu pointer
|
||||
// ====================================================================
|
||||
|
||||
var body_background = '#e2e2e2';
|
||||
|
||||
MenuPointer = function(parent, label) {
|
||||
var me = this;
|
||||
this.wrapper = $a(parent, 'div', '', {padding:'0px', cursor:'pointer', margin:'2px 0px'});
|
||||
$br(this.wrapper, '3px');
|
||||
|
||||
this.tab = make_table($a(this.wrapper, 'div'), 1, 2, '100%', ['', '11px'], {height:'22px',
|
||||
verticalAlign:'middle', padding:'0px'}, {borderCollapse:'collapse', tableLayout:'fixed'});
|
||||
|
||||
$y($td(this.tab, 0, 0), {padding:'0px 4px', color:'#444', whiteSpace:'nowrap'});
|
||||
|
||||
// triangle border (?)
|
||||
this.tab.triangle_div = $a($td(this.tab, 0, 1), 'div','', {
|
||||
borderColor: body_background + ' ' + body_background + ' ' + body_background + ' ' + 'transparent',
|
||||
borderWidth:'11px', borderStyle:'solid', height:'0px', width:'0px', marginRight:'-11px'});
|
||||
|
||||
this.label_area = $a($td(this.tab, 0, 0), 'span', '', '', label);
|
||||
|
||||
$(this.wrapper)
|
||||
.hover(
|
||||
function() { if(!me.selected)
|
||||
$bg(this, '#eee'); } ,
|
||||
function() { if(!me.selected)
|
||||
$bg(this, body_background); }
|
||||
)
|
||||
|
||||
$y($td(this.tab, 0, 0), {borderBottom:'1px solid #ddd'});
|
||||
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
MenuPointer.prototype.select = function(grey) {
|
||||
$y($td(this.tab, 0, 0), {
|
||||
color:'#fff', borderBottom:'0px solid #000'
|
||||
});
|
||||
$(this.wrapper).css('background-color', '#999');
|
||||
this.selected = 1;
|
||||
|
||||
if(cur_menu_pointer && cur_menu_pointer != this)
|
||||
cur_menu_pointer.deselect();
|
||||
|
||||
cur_menu_pointer = this;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
MenuPointer.prototype.deselect = function() {
|
||||
$y($td(this.tab, 0, 0), {color:'#444', borderBottom:'1px solid #ddd'});
|
||||
$(this.wrapper).css('background-color', body_background);
|
||||
this.selected = 0;
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================
|
||||
// Sidebar Item
|
||||
// ====================================================================
|
||||
|
||||
var cur_sidebar_item = null;
|
||||
|
||||
SidebarItem = function(det) {
|
||||
var me = this;
|
||||
this.det = det;
|
||||
this.wrapper = $a(page_body.left_sidebar, 'div', '', {marginRight:'12px'});
|
||||
|
||||
this.body = $a(this.wrapper, 'div');
|
||||
this.tab = make_table(this.body, 1, 2, '100%', ['24px', null], {verticalAlign:'middle'}, {tableLayout:'fixed'});
|
||||
|
||||
// icon
|
||||
var ic = $a($td(this.tab, 0, 0), 'div', 'module-icons module-icons-' + det.module_label.toLowerCase(), {marginLeft:'3px', marginBottom:'-2px'});
|
||||
|
||||
// pointer table
|
||||
this.pointer = new MenuPointer($td(this.tab, 0, 1), det.module_label);
|
||||
$y($td(this.pointer.tab, 0, 0), {fontWeight:'bold'});
|
||||
|
||||
// for page type
|
||||
if(det.module_page) {
|
||||
menu_item_map.Page[det.module_page] = this.pointer;
|
||||
}
|
||||
|
||||
// items area
|
||||
this.items_area = $a(this.wrapper, 'div');
|
||||
|
||||
this.body.onclick = function() { me.onclick(); }
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.onclick = function() {
|
||||
var me = this;
|
||||
|
||||
if(this.det.module_page) {
|
||||
// page type
|
||||
this.pointer.select();
|
||||
|
||||
$(me.pointer.label_area).set_working();
|
||||
loadpage(this.det.module_page, function() {
|
||||
$(me.pointer.label_area).done_working();
|
||||
});
|
||||
|
||||
} else {
|
||||
// show sub items
|
||||
this.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.collapse = function() {
|
||||
$(this.items_area).slideUp();
|
||||
this.is_open = 0;
|
||||
$fg(this.pointer.label_area, '#444')
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.toggle = function() {
|
||||
if(this.loading) return;
|
||||
|
||||
if(this.is_open) {
|
||||
this.collapse();
|
||||
} else {
|
||||
if(this.loaded) $(this.items_area).slideDown();
|
||||
else this.show_items();
|
||||
this.is_open = 1;
|
||||
$fg(this.pointer.label_area, '#000')
|
||||
//this.pointer.select(1);
|
||||
|
||||
// close existing open
|
||||
if(cur_sidebar_item && cur_sidebar_item != this) {
|
||||
cur_sidebar_item.collapse();
|
||||
}
|
||||
cur_sidebar_item = this;
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.show_items = function() {
|
||||
this.loading = 1;
|
||||
var me = this;
|
||||
|
||||
$(this.pointer.label_area).set_working();
|
||||
var callback = function(r,rt){
|
||||
me.loaded = 1;
|
||||
me.loading = 0;
|
||||
var smi = null;
|
||||
var has_reports = 0;
|
||||
var has_tools = 0;
|
||||
|
||||
// widget code
|
||||
$(me.pointer.label_area).done_working();
|
||||
|
||||
if(r.message.il) {
|
||||
me.il = r.message.il;
|
||||
|
||||
// forms
|
||||
for(var i=0; i<me.il.length;i++){
|
||||
if(me.il[i].doc_type == 'Forms') {
|
||||
if(in_list(profile.can_read, me.il[i].doc_name)) {
|
||||
var smi = new SidebarModuleItem(me, me.il[i]);
|
||||
|
||||
menu_item_map['Form'][me.il[i].doc_name] = smi.pointer;
|
||||
menu_item_map['List'][me.il[i].doc_name] = smi.pointer;
|
||||
}
|
||||
}
|
||||
if(me.il[i].doc_type=='Reports') has_reports = 1;
|
||||
if(in_list(['Single DocType', 'Pages', 'Setup Forms'], me.il[i].doc_type))
|
||||
has_tools = 1;
|
||||
}
|
||||
// reports
|
||||
if(has_reports) {
|
||||
var smi = new SidebarModuleItem(me, {doc_name:'Reports', doc_type:'Reports'});
|
||||
|
||||
// add to menu-item mapper
|
||||
menu_item_map['Page'][me.det.module_label + ' Reports'] = smi.pointer;
|
||||
}
|
||||
|
||||
// tools
|
||||
if(has_tools) {
|
||||
var smi = new SidebarModuleItem(me, {doc_name:'Tools', doc_type:'Tools'});
|
||||
|
||||
// add to menu-item mapper
|
||||
menu_item_map['Page'][me.det.module_label + ' Tools'] = smi.pointer;
|
||||
}
|
||||
|
||||
// custom reports
|
||||
if(r.message.custom_reports.length) {
|
||||
me.il = add_lists(r.message.il, r.message.custom_reports);
|
||||
var smi = new SidebarModuleItem(me, {doc_name:'Custom Reports', doc_type:'Custom Reports'});
|
||||
|
||||
// add to menu-item mapper
|
||||
menu_item_map['Page'][me.det.module_label + ' Custom Reports'] = smi.pointer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(me.items_area).slideDown();
|
||||
|
||||
// high light
|
||||
var no = nav_obj.ol[nav_obj.ol.length-1];
|
||||
if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
|
||||
pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
|
||||
|
||||
}
|
||||
|
||||
$c_obj('Home Control', 'get_module_details', me.det.name, callback);
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// Show Reports
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.show_section = function(sec_type) {
|
||||
var me = this;
|
||||
var label = this.det.module_label + ' ' + sec_type;
|
||||
var type_map = {'Reports':'Reports', 'Custom Reports':'Custom Reports',
|
||||
'Pages':'Tools', 'Single DocType':'Tools', 'Setup Forms':'Tools'}
|
||||
|
||||
|
||||
if(page_body.pages[label]) {
|
||||
loadpage(label, null, 1);
|
||||
} else {
|
||||
|
||||
// make the reports page
|
||||
var page = page_body.add_page(label);
|
||||
this.wrapper = $a(page,'div','layout_wrapper');
|
||||
|
||||
|
||||
// head
|
||||
this.head = new PageHeader(this.wrapper, label);
|
||||
|
||||
// body
|
||||
this.body1 = $a(this.wrapper, 'div', '', {marginTop:'16px'});
|
||||
|
||||
// add a report link
|
||||
var add_link = function(det) {
|
||||
var div = $a(me.body1, 'div', '', {marginBottom:'6px'});
|
||||
var span = $a(div, 'span', 'link_type');
|
||||
|
||||
// tag the span
|
||||
span.innerHTML = det.display_name; span.det = det;
|
||||
if(sec_type=='Reports' || sec_type=='Custom Reports') {
|
||||
// Reports
|
||||
// -------
|
||||
span.onclick = function() { loadreport(this.det.doc_name, this.det.display_name); }
|
||||
|
||||
} else {
|
||||
// Tools
|
||||
// -----
|
||||
|
||||
if(det.doc_type=='Pages') {
|
||||
// Page
|
||||
if(det.click_function) {
|
||||
span.onclick = function() { eval(this.det.click_function) }
|
||||
span.click_function = det.click_function;
|
||||
} else {
|
||||
span.onclick = function() { loadpage(this.det.doc_name); }
|
||||
}
|
||||
} else if(det.doc_type=='Setup Forms') {
|
||||
// Doc Browser
|
||||
span.onclick = function() { loaddocbrowser(this.det.doc_name); }
|
||||
} else {
|
||||
// Single
|
||||
span.onclick = function() { loaddoc(this.det.doc_name, this.det.doc_name); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// item list
|
||||
for(var i=0; i<me.il.length;i++){
|
||||
if(type_map[me.il[i].doc_type] == sec_type) {
|
||||
add_link(me.il[i]);
|
||||
}
|
||||
}
|
||||
loadpage(label, null, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================
|
||||
// Sidebar module item
|
||||
// ====================================================================
|
||||
|
||||
SidebarModuleItem = function(si, det) {
|
||||
this.det = det;
|
||||
var me= this;
|
||||
|
||||
this.pointer = new MenuPointer(si.items_area, get_doctype_label(det.doc_name));
|
||||
$y(si.items_area, {marginLeft:'32px'})
|
||||
$y($td(this.pointer.tab, 0, 0), {fontSize:'11px'});
|
||||
|
||||
this.pointer.wrapper.onclick = function() {
|
||||
if(me.det.doc_type=='Forms')
|
||||
loaddocbrowser(det.doc_name);
|
||||
else
|
||||
si.show_section(me.det.doc_type);
|
||||
}
|
||||
}
|
36
erpnext/startup/modules_new.js
Normal file
36
erpnext/startup/modules_new.js
Normal file
@ -0,0 +1,36 @@
|
||||
// Tools Page
|
||||
erpnext.ListPage = Class.extend({
|
||||
init: function(opts) {
|
||||
var me = this;
|
||||
this.opts = opts;
|
||||
this.page = page_body.add_page[opts.title];
|
||||
this.page.wrapper = $a(this.page, 'div', 'layout_wrapper');
|
||||
this.page.head = new PageHeading(this.wrapper, this.title)
|
||||
this.page.list = new wn.widgets.Listing({
|
||||
parent: this.page.wrapper,
|
||||
query: opts.query,
|
||||
render:row: opts.render_row
|
||||
});
|
||||
},
|
||||
show: function() {
|
||||
if(this.first) {
|
||||
this.page.list.run();
|
||||
this.first = false;
|
||||
}
|
||||
page_body.change_to(this.opts.title);
|
||||
}
|
||||
});
|
||||
|
||||
erpnext.ToolsPage = erpnext.ListPage.extend({
|
||||
init: function(opts) {
|
||||
this._super({
|
||||
title: opts.module + ' Settings',
|
||||
query: repl('select name, description from tabDocType where \
|
||||
module=%(module)s and ifnull(issingle,0)=1 order by name asc', opts),
|
||||
render_row: function(parent, data) {
|
||||
parent.innerHTML = repl('<a href="#!Form/%(name)s/%(name)s">%(name)s</a>\
|
||||
<div class="comment">%(description)s</div>', data)
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
@ -1,33 +1,29 @@
|
||||
h1, h2, h3, h4 {
|
||||
font-family: Tahoma, Sans Serif;
|
||||
h1, h2, h3, h4, h5 {
|
||||
font-family: Tahoma, Arial, Verdana, sans-serif;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
body, span, div, td, input, textarea, button, select {
|
||||
body {
|
||||
font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
span, div, td, input, textarea, button, select {
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #e2e2e2;
|
||||
}
|
||||
|
||||
.layout_wrapper {
|
||||
padding: 13px;
|
||||
margin: 7px;
|
||||
-moz-box-shadow: 1px 1px 6px #AAA;
|
||||
-webkit-box-shadow: 1px 1px 6px #AAA;
|
||||
box-shadow: 1px 1px 6px #AAA;
|
||||
background-color: #FFF;
|
||||
.erpnext-footer {
|
||||
margin: 3px auto;
|
||||
color: #888;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#birthday_area {
|
||||
display: none;
|
||||
padding: 4px;
|
||||
margin-bottom: 8px;
|
||||
background-color: #FDD;
|
||||
padding: 4px;
|
||||
color: #644;
|
||||
.erpnext-footer a, .erpnext-footer a:hover, .erpnext-footer a:visited {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.module-icons {
|
||||
|
@ -1,461 +1,47 @@
|
||||
if(user == 'Guest'){
|
||||
$dh(page_body.left_sidebar);
|
||||
}
|
||||
|
||||
var current_module;
|
||||
var is_system_manager = 0;
|
||||
var module_content_dict = {};
|
||||
var user_full_nm = {};
|
||||
|
||||
// check if session user is system manager
|
||||
if(inList(user_roles,'System Manager')) is_system_manager = 1;
|
||||
wn.provide('erpnext.startup');
|
||||
|
||||
function startup_setup() {
|
||||
pscript.is_erpnext_saas = cint(locals['Control Panel']['Control Panel'].sync_with_gateway)
|
||||
|
||||
|
||||
if(get_url_arg('embed')) {
|
||||
// hide header, footer
|
||||
$dh(page_body.banner_area);
|
||||
$dh(page_body.wntoolbar);
|
||||
$dh(page_body.footer);
|
||||
return;
|
||||
}
|
||||
|
||||
if(user=='Guest' && !get_url_arg('akey')) {
|
||||
if(pscript.is_erpnext_saas) {
|
||||
window.location.href = 'https://www.erpnext.com';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// page structure
|
||||
// --------------
|
||||
$td(page_body.wntoolbar.body_tab,0,0).innerHTML = '<i><b>erp</b>next</i>';
|
||||
$y($td(page_body.wntoolbar.body_tab,0,0), {width:'140px', color:'#FFF', paddingLeft:'8px', paddingRight:'8px', fontSize:'14px'})
|
||||
$dh(page_body.banner_area);
|
||||
|
||||
// sidebar
|
||||
// -------
|
||||
pscript.startup_make_sidebar();
|
||||
|
||||
// border to the body
|
||||
// ------------------
|
||||
$dh(page_body.footer);
|
||||
|
||||
// setup toolbar
|
||||
pscript.startup_setup_toolbar();
|
||||
erpnext.startup.set_globals = function() {
|
||||
pscript.is_erpnext_saas = cint(wn.control_panel.sync_with_gateway)
|
||||
if(inList(user_roles,'System Manager')) is_system_manager = 1;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
pscript.startup_make_sidebar = function() {
|
||||
$y(page_body.left_sidebar, {width:(100/6)+'%', paddingTop:'8px'});
|
||||
|
||||
var callback = function(r,rt) {
|
||||
// menu
|
||||
var ml = r.message;
|
||||
|
||||
// login-file
|
||||
if(r.login_url){
|
||||
login_file = 'http://' + r.login_url;
|
||||
}
|
||||
else if(pscript.is_erpnext_saas) {
|
||||
login_file = 'https://www.erpnext.com';
|
||||
}
|
||||
|
||||
// clear
|
||||
page_body.left_sidebar.innerHTML = '';
|
||||
|
||||
for(var m=0; m<ml.length; m++){
|
||||
if(ml[m]) {
|
||||
new SidebarItem(ml[m]);
|
||||
}
|
||||
}
|
||||
if(in_list(user_roles, 'System Manager')) {
|
||||
var div = $a(page_body.left_sidebar, 'div', 'link_type', {padding:'8px', fontSize:'11px'});
|
||||
$(div).html('[edit]').click(pscript.startup_set_module_order)
|
||||
}
|
||||
nav_obj.observers.push({notify:function(t,dt,dn) { pscript.select_sidebar_menu(t, dt, dn); }});
|
||||
|
||||
// select current
|
||||
var no = nav_obj.ol[nav_obj.ol.length-1];
|
||||
if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
|
||||
pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
|
||||
}
|
||||
$c_obj('Home Control', 'get_modules', '', callback);
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// Menu observer
|
||||
// ====================================================================
|
||||
|
||||
cur_menu_pointer = null;
|
||||
var menu_item_map = {'Form':{}, 'Page':{}, 'Report':{}, 'List':{}}
|
||||
|
||||
pscript.select_sidebar_menu = function(t, dt, dn) {
|
||||
// get menu item
|
||||
if(menu_item_map[t][dt]) {
|
||||
// select
|
||||
menu_item_map[t][dt].select();
|
||||
} else {
|
||||
// none found :-( Unselect
|
||||
if(cur_menu_pointer)
|
||||
cur_menu_pointer.deselect();
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// Menu pointer
|
||||
// ====================================================================
|
||||
|
||||
var body_background = '#e2e2e2';
|
||||
|
||||
MenuPointer = function(parent, label) {
|
||||
|
||||
this.wrapper = $a(parent, 'div', '', {padding:'0px', cursor:'pointer', margin:'2px 0px'});
|
||||
$br(this.wrapper, '3px');
|
||||
|
||||
this.tab = make_table($a(this.wrapper, 'div'), 1, 2, '100%', ['', '11px'], {height:'22px',
|
||||
verticalAlign:'middle', padding:'0px'}, {borderCollapse:'collapse', tableLayout:'fixed'});
|
||||
|
||||
$y($td(this.tab, 0, 0), {padding:'0px 4px', color:'#444', whiteSpace:'nowrap'});
|
||||
|
||||
// triangle border (?)
|
||||
this.tab.triangle_div = $a($td(this.tab, 0, 1), 'div','', {
|
||||
borderColor: body_background + ' ' + body_background + ' ' + body_background + ' ' + 'transparent',
|
||||
borderWidth:'11px', borderStyle:'solid', height:'0px', width:'0px', marginRight:'-11px'});
|
||||
|
||||
this.label_area = $a($td(this.tab, 0, 0), 'span', '', '', label);
|
||||
|
||||
$(this.wrapper)
|
||||
.hover(
|
||||
function() { if(!this.selected)$bg(this, '#eee'); } ,
|
||||
function() { if(!this.selected)$bg(this, body_background); }
|
||||
)
|
||||
|
||||
$y($td(this.tab, 0, 0), {borderBottom:'1px solid #ddd'});
|
||||
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
MenuPointer.prototype.select = function(grey) {
|
||||
$y($td(this.tab, 0, 0), {color:'#fff', borderBottom:'0px solid #000'});
|
||||
//$gr(this.wrapper, '#F84', '#F63');
|
||||
$gr(this.wrapper, '#888', '#666');
|
||||
this.selected = 1;
|
||||
|
||||
if(cur_menu_pointer && cur_menu_pointer != this)
|
||||
cur_menu_pointer.deselect();
|
||||
|
||||
cur_menu_pointer = this;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
MenuPointer.prototype.deselect = function() {
|
||||
$y($td(this.tab, 0, 0), {color:'#444', borderBottom:'1px solid #ddd'});
|
||||
$gr(this.wrapper, body_background, body_background);
|
||||
this.selected = 0;
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================
|
||||
// Sidebar Item
|
||||
// ====================================================================
|
||||
|
||||
var cur_sidebar_item = null;
|
||||
|
||||
SidebarItem = function(det) {
|
||||
var me = this;
|
||||
this.det = det;
|
||||
this.wrapper = $a(page_body.left_sidebar, 'div', '', {marginRight:'12px'});
|
||||
|
||||
this.body = $a(this.wrapper, 'div');
|
||||
this.tab = make_table(this.body, 1, 2, '100%', ['24px', null], {verticalAlign:'middle'}, {tableLayout:'fixed'});
|
||||
|
||||
// icon
|
||||
var ic = $a($td(this.tab, 0, 0), 'div', 'module-icons module-icons-' + det.module_label.toLowerCase(), {marginLeft:'3px', marginBottom:'-2px'});
|
||||
|
||||
// pointer table
|
||||
this.pointer = new MenuPointer($td(this.tab, 0, 1), det.module_label);
|
||||
$y($td(this.pointer.tab, 0, 0), {fontWeight:'bold'});
|
||||
|
||||
// for page type
|
||||
if(det.module_page) {
|
||||
menu_item_map.Page[det.module_page] = this.pointer;
|
||||
}
|
||||
|
||||
// items area
|
||||
this.items_area = $a(this.wrapper, 'div');
|
||||
|
||||
this.body.onclick = function() { me.onclick(); }
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.onclick = function() {
|
||||
var me = this;
|
||||
|
||||
if(this.det.module_page) {
|
||||
// page type
|
||||
this.pointer.select();
|
||||
|
||||
$item_set_working(me.pointer.label_area);
|
||||
loadpage(this.det.module_page, function() { $item_done_working(me.pointer.label_area); });
|
||||
|
||||
} else {
|
||||
// show sub items
|
||||
this.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.collapse = function() {
|
||||
$(this.items_area).slideUp();
|
||||
this.is_open = 0;
|
||||
$fg(this.pointer.label_area, '#444')
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.toggle = function() {
|
||||
if(this.loading) return;
|
||||
|
||||
if(this.is_open) {
|
||||
this.collapse();
|
||||
} else {
|
||||
if(this.loaded) $(this.items_area).slideDown();
|
||||
else this.show_items();
|
||||
this.is_open = 1;
|
||||
$fg(this.pointer.label_area, '#000')
|
||||
//this.pointer.select(1);
|
||||
|
||||
// close existing open
|
||||
if(cur_sidebar_item && cur_sidebar_item != this) {
|
||||
cur_sidebar_item.collapse();
|
||||
}
|
||||
cur_sidebar_item = this;
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.show_items = function() {
|
||||
this.loading = 1;
|
||||
var me = this;
|
||||
|
||||
$item_set_working(this.pointer.label_area);
|
||||
var callback = function(r,rt){
|
||||
me.loaded = 1;
|
||||
me.loading = 0;
|
||||
var smi = null;
|
||||
var has_reports = 0;
|
||||
var has_tools = 0;
|
||||
|
||||
// widget code
|
||||
$item_done_working(me.pointer.label_area);
|
||||
|
||||
if(r.message.il) {
|
||||
me.il = r.message.il;
|
||||
|
||||
// forms
|
||||
for(var i=0; i<me.il.length;i++){
|
||||
if(me.il[i].doc_type == 'Forms') {
|
||||
if(in_list(profile.can_read, me.il[i].doc_name)) {
|
||||
var smi = new SidebarModuleItem(me, me.il[i]);
|
||||
|
||||
menu_item_map['Form'][me.il[i].doc_name] = smi.pointer;
|
||||
menu_item_map['List'][me.il[i].doc_name] = smi.pointer;
|
||||
}
|
||||
}
|
||||
if(me.il[i].doc_type=='Reports') has_reports = 1;
|
||||
if(in_list(['Single DocType', 'Pages', 'Setup Forms'], me.il[i].doc_type)) has_tools = 1;
|
||||
}
|
||||
// reports
|
||||
if(has_reports) {
|
||||
var smi = new SidebarModuleItem(me, {doc_name:'Reports', doc_type:'Reports'});
|
||||
|
||||
// add to menu-item mapper
|
||||
menu_item_map['Page'][me.det.module_label + ' Reports'] = smi.pointer;
|
||||
}
|
||||
|
||||
// tools
|
||||
if(has_tools) {
|
||||
var smi = new SidebarModuleItem(me, {doc_name:'Tools', doc_type:'Tools'});
|
||||
|
||||
// add to menu-item mapper
|
||||
menu_item_map['Page'][me.det.module_label + ' Tools'] = smi.pointer;
|
||||
}
|
||||
|
||||
// custom reports
|
||||
if(r.message.custom_reports.length) {
|
||||
me.il = add_lists(r.message.il, r.message.custom_reports);
|
||||
var smi = new SidebarModuleItem(me, {doc_name:'Custom Reports', doc_type:'Custom Reports'});
|
||||
|
||||
// add to menu-item mapper
|
||||
menu_item_map['Page'][me.det.module_label + ' Custom Reports'] = smi.pointer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(me.items_area).slideDown();
|
||||
|
||||
// high light
|
||||
var no = nav_obj.ol[nav_obj.ol.length-1];
|
||||
if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
|
||||
pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
|
||||
|
||||
}
|
||||
|
||||
$c_obj('Home Control', 'get_module_details', me.det.name, callback);
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// Show Reports
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.show_section = function(sec_type) {
|
||||
var me = this;
|
||||
var label = this.det.module_label + ' ' + sec_type;
|
||||
var type_map = {'Reports':'Reports', 'Custom Reports':'Custom Reports', 'Pages':'Tools', 'Single DocType':'Tools', 'Setup Forms':'Tools'}
|
||||
|
||||
if(page_body.pages[label]) {
|
||||
loadpage(label, null, 1);
|
||||
} else {
|
||||
// make the reports page
|
||||
var page = page_body.add_page(label);
|
||||
this.wrapper = $a(page,'div','layout_wrapper');
|
||||
|
||||
|
||||
// head
|
||||
this.head = new PageHeader(this.wrapper, label);
|
||||
|
||||
// body
|
||||
this.body1 = $a(this.wrapper, 'div', '', {marginTop:'16px'});
|
||||
|
||||
// add a report link
|
||||
var add_link = function(det) {
|
||||
var div = $a(me.body1, 'div', '', {marginBottom:'6px'});
|
||||
var span = $a(div, 'span', 'link_type');
|
||||
|
||||
// tag the span
|
||||
span.innerHTML = det.display_name; span.det = det;
|
||||
if(sec_type=='Reports' || sec_type=='Custom Reports') {
|
||||
// Reports
|
||||
// -------
|
||||
span.onclick = function() { loadreport(this.det.doc_name, this.det.display_name); }
|
||||
|
||||
} else {
|
||||
// Tools
|
||||
// -----
|
||||
|
||||
if(det.doc_type=='Pages') {
|
||||
// Page
|
||||
if(det.click_function) {
|
||||
span.onclick = function() { eval(this.det.click_function) }
|
||||
span.click_function = det.click_function;
|
||||
} else {
|
||||
span.onclick = function() { loadpage(this.det.doc_name); }
|
||||
}
|
||||
} else if(det.doc_type=='Setup Forms') {
|
||||
// Doc Browser
|
||||
span.onclick = function() { loaddocbrowser(this.det.doc_name); }
|
||||
} else {
|
||||
// Single
|
||||
span.onclick = function() { loaddoc(this.det.doc_name, this.det.doc_name); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// item list
|
||||
for(var i=0; i<me.il.length;i++){
|
||||
if(type_map[me.il[i].doc_type] == sec_type) {
|
||||
add_link(me.il[i]);
|
||||
}
|
||||
}
|
||||
loadpage(label, null, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================
|
||||
// Sidebar module item
|
||||
// ====================================================================
|
||||
|
||||
SidebarModuleItem = function(si, det) {
|
||||
this.det = det;
|
||||
var me= this;
|
||||
|
||||
this.pointer = new MenuPointer(si.items_area, get_doctype_label(det.doc_name));
|
||||
$y(si.items_area, {marginLeft:'32px'})
|
||||
$y($td(this.pointer.tab, 0, 0), {fontSize:'11px'});
|
||||
|
||||
this.pointer.wrapper.onclick = function() {
|
||||
if(me.det.doc_type=='Forms')
|
||||
loaddocbrowser(det.doc_name);
|
||||
else
|
||||
si.show_section(me.det.doc_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================
|
||||
// Drag & Drop order selection
|
||||
// ====================================================================
|
||||
|
||||
pscript.startup_set_module_order = function() {
|
||||
var update_order= function(ml) {
|
||||
mdict = {};
|
||||
for(var i=0; i<ml.length; i++) {
|
||||
mdict[ml[i][3][3]] = {'module_seq':ml[i][1], 'is_hidden':(ml[i][2] ? 'No' : 'Yes')}
|
||||
}
|
||||
$c_obj('Home Control', 'set_module_order', JSON.stringify(mdict), function(r,rt) { pscript.startup_make_sidebar(); } )
|
||||
}
|
||||
|
||||
var callback = function(r, rt) {
|
||||
var ml = [];
|
||||
for(var i=0; i<r.message.length; i++) {
|
||||
var det = r.message[i];
|
||||
ml.push([det[1], det[2], (det[3]!='No' ? 0 : 1), det[0]]);
|
||||
}
|
||||
new ListSelector('Set Module Sequence', 'Select items and set the order you want them to appear'+
|
||||
'<br><b>Note:</b> <i>These changes will apply to all users!</i>', ml, update_order, 1);
|
||||
}
|
||||
$c_obj('Home Control', 'get_module_order', '', callback)
|
||||
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
pscript.startup_setup_toolbar = function() {
|
||||
var menu_tab = page_body.wntoolbar.menu_table_right;
|
||||
// help
|
||||
// ----
|
||||
$td(menu_tab,0,0).innerHTML = '<a style="font-weight: bold; color: #FFF" href="http://erpnext.blogspot.com/2011/03/erpnext-help.html" target="_blank">Help</a>';
|
||||
erpnext.startup.start = function() {
|
||||
$('#startup_div').html('Starting up...').toggle(true);
|
||||
|
||||
$td(menu_tab,0,1).innerHTML = '<a style="font-weight: bold; color: #FFF" href="http://groups.google.com/group/erpnext-user-forum" target="_blank">Forum</a>';
|
||||
erpnext.startup.set_globals();
|
||||
|
||||
if(pscript.is_erpnext_saas){
|
||||
// Live Chat Help
|
||||
// --------------
|
||||
$td(menu_tab,0,2).innerHTML = '<a style="font-weight: bold; color: #FFF" href="http://www.providesupport.com?messenger=iwebnotes" target="_blank">Chat</a>';
|
||||
|
||||
// Manage account
|
||||
// --------------
|
||||
if(is_system_manager) {
|
||||
$td(menu_tab,0,3).innerHTML = '<a style="font-weight: bold; color: #FFF;" href="#!billing">Billing</a>';
|
||||
if(user == 'Guest'){
|
||||
$dh(page_body.left_sidebar);
|
||||
wn.require('erpnext/website/css/website.css');
|
||||
wn.require('erpnext/website/js/topbar.js');
|
||||
if(wn.boot.custom_css) {
|
||||
set_style(wn.boot.custom_css);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$dh($td(menu_tab,0,2));
|
||||
$dh($td(menu_tab,0,3));
|
||||
}
|
||||
if(wn.boot.website_settings.title_prefix) {
|
||||
wn.title_prefix = wn.boot.website_settings.title_prefix;
|
||||
}
|
||||
} else {
|
||||
// modules
|
||||
wn.require('erpnext/startup/modules.js');
|
||||
pscript.startup_make_sidebar();
|
||||
|
||||
$y(cell, page_body.wntoolbar.right_table_style);
|
||||
// setup toolbar
|
||||
wn.require('erpnext/startup/toolbar.js');
|
||||
erpnext.toolbar.setup();
|
||||
wn.require('erpnext/startup/feature_setup.js');
|
||||
|
||||
// border to the body
|
||||
// ------------------
|
||||
$('footer').html('<div class="erpnext-footer">\
|
||||
Powered by <a href="https://erpnext.com">ERPNext</a></div>');
|
||||
}
|
||||
|
||||
$('#startup_div').toggle(false);
|
||||
}
|
||||
|
||||
// chart of accounts
|
||||
@ -496,224 +82,5 @@ ModulePage = function(parent, module_name, module_label, help_page, callback) {
|
||||
if(callback) this.callback = function(){ callback(); }
|
||||
}
|
||||
|
||||
|
||||
// get plural
|
||||
// ====================================================================
|
||||
|
||||
get_plural = function(str){
|
||||
if(str.charAt(str.length-1).toLowerCase() == 'y') return str.substr(0, str.length-1) + 'ies'
|
||||
else return str + 's';
|
||||
}
|
||||
|
||||
// set user fullname
|
||||
// ====================================================================
|
||||
pscript.set_user_fullname = function(ele,username,get_latest){
|
||||
|
||||
var set_it = function(){
|
||||
if(ele)
|
||||
ele.innerHTML = user_full_nm[username];
|
||||
}
|
||||
|
||||
if(get_latest){
|
||||
$c_obj('Home Control','get_user_fullname',username, function(r,rt){ user_full_nm[username] = r.message; set_it(); });
|
||||
}
|
||||
else{
|
||||
if(user_full_nm[username]){
|
||||
set_it();
|
||||
}
|
||||
|
||||
else
|
||||
$c_obj('Home Control','get_user_fullname',username, function(r,rt){ user_full_nm[username] = r.message; set_it(); });
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
startup_setup();
|
||||
|
||||
/* features setup "Dictionary", "Script"
|
||||
Dictionary Format
|
||||
'projects': {
|
||||
'Sales Order': {
|
||||
'fields':['project_name'],
|
||||
'sales_order_details':['projected_qty']
|
||||
},
|
||||
'Purchase Order': {
|
||||
'fields':['project_name']
|
||||
}
|
||||
}
|
||||
// ====================================================================*/
|
||||
pscript.feature_dict = {
|
||||
'fs_projects': {
|
||||
'Bill Of Materials': {'fields':['project_name']},
|
||||
'Delivery Note': {'fields':['project_name']},
|
||||
'Payable Voucher': {'fields':['project_name']},
|
||||
'Production Order': {'fields':['project_name']},
|
||||
'Purchase Order': {'fields':['project_name']},
|
||||
'Purchase Receipt': {'fields':['project_name']},
|
||||
'Receivable Voucher': {'fields':['project_name']},
|
||||
'Sales Order': {'fields':['project_name']},
|
||||
'Stock Entry': {'fields':['project_name']},
|
||||
'Timesheet': {'timesheet_details':['project_name']}
|
||||
},
|
||||
'fs_packing_details': {
|
||||
'Delivery Note': {'fields':['packing_details','print_packing_slip','packing_checked_by','packed_by','pack_size','shipping_mark'],'delivery_note_details':['no_of_packs','pack_gross_wt','pack_nett_wt','pack_no','pack_unit']},
|
||||
'Sales Order': {'fields':['packing_details']}
|
||||
},
|
||||
'fs_discounts': {
|
||||
'Delivery Note': {'delivery_note_details':['adj_rate']},
|
||||
'Quotation': {'quotation_details':['adj_rate']},
|
||||
'Receivable Voucher': {'entries':['adj_rate']},
|
||||
'Sales Order': {'sales_order_details':['adj_rate','ref_rate']}
|
||||
},
|
||||
'fs_purchase_discounts': {
|
||||
'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
|
||||
'Payable Voucher': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}
|
||||
},
|
||||
'fs_brands': {
|
||||
'Delivery Note': {'delivery_note_details':['brand']},
|
||||
'Indent': {'indent_details':['brand']},
|
||||
'Item': {'fields':['brand']},
|
||||
'Purchase Order': {'po_details':['brand']},
|
||||
'Payable Voucher': {'entries':['brand']},
|
||||
'Quotation': {'quotation_details':['brand']},
|
||||
'Receivable Voucher': {'entries':['brand']},
|
||||
'Sales BOM': {'fields':['new_item_brand']},
|
||||
'Sales Order': {'sales_order_details':['brand']},
|
||||
'Serial No': {'fields':['brand']}
|
||||
},
|
||||
'fs_after_sales_installations': {
|
||||
'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']}
|
||||
},
|
||||
'fs_item_batch_nos': {
|
||||
'Delivery Note': {'delivery_note_details':['batch_no']},
|
||||
'Item': {'fields':['has_batch_no']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['batch_no']},
|
||||
'QA Inspection Report': {'fields':['batch_no']},
|
||||
'Sales and Pruchase Return Wizard': {'return_details':['batch_no']},
|
||||
'Receivable Voucher': {'entries':['batch_no']},
|
||||
'Stock Entry': {'mtn_details':['batch_no']},
|
||||
'Stock Ledger Entry': {'fields':['batch_no']}
|
||||
},
|
||||
'fs_item_serial_nos': {
|
||||
'Customer Issue': {'fields':['serial_no']},
|
||||
'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']},
|
||||
'Installation Note': {'installed_item_details':['serial_no']},
|
||||
'Item': {'fields':['has_serial_no']},
|
||||
'Maintenance Schedule': {'item_maintenance_details':['serial_no'],'maintenance_schedule_details':['serial_no']},
|
||||
'Maintenance Visit': {'maintenance_visit_details':['serial_no']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['serial_no']},
|
||||
'QA Inspection Report': {'fields':['item_serial_no']},
|
||||
'Sales and Pruchase Return Wizard': {'return_details':['serial_no']},
|
||||
'Receivable Voucher': {'entries':['serial_no']},
|
||||
'Stock Entry': {'mtn_details':['serial_no']},
|
||||
'Stock Ledger Entry': {'fields':['serial_no']}
|
||||
},
|
||||
'fs_item_group_in_details': {
|
||||
'Delivery Note': {'delivery_note_details':['item_group']},
|
||||
'Enquiry': {'enquiry_details':['item_group']},
|
||||
'Indent': {'indent_details':['item_group']},
|
||||
'Item': {'fields':['item_group']},
|
||||
'Manage Account': {'fields':['default_item_group']},
|
||||
'Purchase Order': {'po_details':['item_group']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['item_group']},
|
||||
'Purchase Voucher': {'entries':['item_group']},
|
||||
'Quotation': {'quotation_details':['item_group']},
|
||||
'Receivable Voucher': {'entries':['item_group']},
|
||||
'Sales BOM': {'fields':['serial_no']},
|
||||
'Sales Order': {'sales_order_details':['item_group']},
|
||||
'Serial No': {'fields':['item_group']},
|
||||
'Sales Partner': {'partner_target_details':['item_group']},
|
||||
'Sales Person': {'target_details':['item_group']},
|
||||
'Territory': {'target_details':['item_group']}
|
||||
},
|
||||
'fs_page_break': {
|
||||
'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']},
|
||||
'Indent': {'indent_details':['page_break']},
|
||||
'Purchase Order': {'po_details':['page_break']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['page_break']},
|
||||
'Purchase Voucher': {'entries':['page_break']},
|
||||
'Quotation': {'quotation_details':['page_break']},
|
||||
'Receivable Voucher': {'entries':['page_break']},
|
||||
'Sales Order': {'sales_order_details':['page_break']}
|
||||
},
|
||||
'fs_exports': {
|
||||
'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']},
|
||||
'POS Setting': {'fields':['conversion_rate','currency']},
|
||||
'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']},
|
||||
'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','export_amount','export_rate']},
|
||||
'Item': {'ref_rate_details':['ref_currency']},
|
||||
'Sales BOM': {'fields':['currency']},
|
||||
'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']}
|
||||
},
|
||||
'fs_imports': {
|
||||
'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']},
|
||||
'Purchase Order': {'fields':['Note HTML','conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'po_details':['import_amount','import_rate']},
|
||||
'Purchase Receipt': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'purchase_receipt_details':['import_amount','import_rate']},
|
||||
'Supplier Quotation': {'fields':['conversion_rate','currency']}
|
||||
},
|
||||
'fs_item_advanced': {
|
||||
'Item': {'fields':['item_customer_details']}
|
||||
},
|
||||
'fs_sales_extras': {
|
||||
'Address': {'fields':['sales_partner']},
|
||||
'Contact': {'fields':['sales_partner']},
|
||||
'Customer': {'fields':['sales_team']},
|
||||
'Delivery Note': {'fields':['sales_team','Packing List']},
|
||||
'Item': {'fields':['item_customer_details']},
|
||||
'Receivable Voucher': {'fields':['sales_team']},
|
||||
'Sales Order': {'fields':['sales_team','Packing List']}
|
||||
},
|
||||
'fs_more_info': {
|
||||
'Customer': {'fields':['More Info']},
|
||||
'Delivery Note': {'fields':['More Info']},
|
||||
'Enquiry': {'fields':['More Info']},
|
||||
'Indent': {'fields':['More Info']},
|
||||
'Lead': {'fields':['More Info']},
|
||||
'Payable Voucher': {'fields':['More Info']},
|
||||
'Purchase Order': {'fields':['More Info']},
|
||||
'Purchase Receipt': {'fields':['More Info']},
|
||||
'Quotation': {'fields':['More Info']},
|
||||
'Receivable Voucher': {'fields':['More Info']},
|
||||
'Sales Order': {'fields':['More Info']},
|
||||
'Serial No': {'fields':['More Info']},
|
||||
'Supplier': {'fields':['More Info']}
|
||||
},
|
||||
'fs_quality': {
|
||||
'Item': {'fields':['Item Inspection Criteria','inspection_required']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['qa_no']}
|
||||
},
|
||||
'fs_manufacturing': {
|
||||
'Item': {'fields':['Manufacturing']}
|
||||
},
|
||||
'fs_pos': {
|
||||
'Receivable Voucher': {'fields':['is_pos']}
|
||||
},
|
||||
'fs_recurring_invoice': {
|
||||
'Receivable Voucher': {'fields': ['Recurring Invoice']}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).bind('form_refresh', function() {
|
||||
for(sys_feat in sys_defaults)
|
||||
{
|
||||
if(sys_defaults[sys_feat]=='0' && (sys_feat in pscript.feature_dict)) //"Features to hide" exists
|
||||
{
|
||||
if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat])
|
||||
{
|
||||
for(fort in pscript.feature_dict[sys_feat][cur_frm.doc.doctype])
|
||||
{
|
||||
if(fort=='fields')
|
||||
hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]);
|
||||
else if(cur_frm.fields_dict[fort])
|
||||
{
|
||||
for(grid_field in pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort])
|
||||
cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort][grid_field], false);
|
||||
}
|
||||
else
|
||||
msgprint('Grid "'+fort+'" does not exists');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
// start
|
||||
erpnext.startup.start();
|
27
erpnext/startup/toolbar.js
Normal file
27
erpnext/startup/toolbar.js
Normal file
@ -0,0 +1,27 @@
|
||||
/* toolbar settings */
|
||||
wn.provide('erpnext.toolbar');
|
||||
|
||||
erpnext.toolbar.setup = function() {
|
||||
// profile
|
||||
$('#toolbar-user').append('<li><a href="#profile-settings">Profile Settings</a></li>')
|
||||
|
||||
// help
|
||||
$('.topbar .secondary-nav').append('<li class="dropdown">\
|
||||
<a class="dropdown-toggle" href="#" onclick="return false;">Help</a>\
|
||||
<ul class="dropdown-menu" id="toolbar-help">\
|
||||
</ul></li>')
|
||||
|
||||
$('#toolbar-help').append('<li><a href="http://erpnext.blogspot.com/2011/03/erpnext-help.html" target="_blank">\
|
||||
Documentation</a></li>')
|
||||
|
||||
$('#toolbar-help').append('<li><a href="http://groups.google.com/group/erpnext-user-forum" target="_blank">\
|
||||
Forum</a></li>')
|
||||
|
||||
$('#toolbar-help').append('<li><a href="http://www.providesupport.com?messenger=iwebnotes" target="_blank">\
|
||||
Live Chat (Office Hours)</a></li>')
|
||||
|
||||
// billing
|
||||
if(pscript.is_erpnext_saas && is_system_manager) {
|
||||
$('#toolbar-user').append('<li><a href="#billing">Billing</a></li>')
|
||||
}
|
||||
}
|
@ -613,34 +613,6 @@
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'manufacturer',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Manufacturer',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'manufacturer_part_no',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Manufacturer Part Number',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_supplier_details',
|
||||
'fieldtype': 'Table',
|
||||
'label': 'Item Supplier Details',
|
||||
'options': 'Item Supplier',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
@ -929,4 +901,4 @@
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
}
|
||||
]
|
||||
]
|
||||
|
@ -84,7 +84,7 @@ $.extend(cur_frm.cscript, {
|
||||
Send: function(doc, dt, dn) {
|
||||
$c_obj([doc], 'send_response', '', function(r,rt) {
|
||||
locals[dt][dn].new_response = '';
|
||||
if(!r.exc) {
|
||||
if(!(r.exc || r.server_messages)) {
|
||||
cur_frm.refresh();
|
||||
}
|
||||
});
|
||||
|
@ -71,6 +71,8 @@ class DocType(TransactionBase):
|
||||
d = Document('Support Ticket Response')
|
||||
d.from_email = from_email or webnotes.user.name
|
||||
d.parent = self.doc.name
|
||||
d.parenttype = "Support Ticket"
|
||||
d.parentfield = "responses"
|
||||
d.mail = response
|
||||
d.content_type = content_type
|
||||
d.save(1)
|
||||
|
@ -1,71 +0,0 @@
|
||||
// Global dictionary of next steps for doctypes
|
||||
// ============================================
|
||||
pscript.tip_prod_dict = {'Production Order':['Material Transfer', 'Backflush']};
|
||||
|
||||
|
||||
// Set tips depending on conditions
|
||||
// ================================
|
||||
cur_frm.cscript.get_tips = function(doc, cdt, cdn){
|
||||
var next_step_list = pscript.tip_prod_dict[cur_frm.doctype] ? pscript.tip_prod_dict[cur_frm.doctype] : 0;
|
||||
|
||||
if(cur_frm.doctype!='Production Planning Tool'){
|
||||
// new doc
|
||||
if(doc.__islocal){
|
||||
if(doc.status=='Cancelled' || doc.amended_from)
|
||||
cur_frm.set_tip("You can now make changes in this " + cur_frm.doctype + " and save it by clicking on the <div style='font-weight:bold; display:inline'>Save</div> button in the above toolbar.");
|
||||
else{
|
||||
cur_frm.set_tip("To create " + cur_frm.doctype + " please start by entering all the mandatory fields (marked <div style='color:Red; display:inline'> Red</div>).");
|
||||
if(cur_frm.doctype=='Stock Entry') cur_frm.append_tip("If your purpose is Production Order, please go to <div style='font-weight:bold; display:inline'>Items</div> tab and click <div style='font-weight:bold; display:inline'>Get Items</div> to fetch the items.");
|
||||
cur_frm.append_tip("You can then save this form by clicking on the <div style='font-weight:bold; display:inline'>Save</div> button in the above toolbar.");
|
||||
}
|
||||
}
|
||||
|
||||
// doc exists
|
||||
else if(!doc.__islocal){
|
||||
// execute when doc is saved
|
||||
if(doc.docstatus==0 && cur_frm.doctype!='Production Planning Tool')
|
||||
cur_frm.set_tip("You have saved your " + cur_frm.doctype + ". You can make this draft permanent by clicking on <div style='font-weight:bold; display:inline'>Submit</div> button above.");
|
||||
|
||||
// execute if doc is submitted
|
||||
else if(doc.docstatus==1){
|
||||
cur_frm.set_tip("You have submitted this " + cur_frm.doctype + ".");
|
||||
for(var i=0; i<next_step_list.length; i++){
|
||||
if(i==0) cur_frm.append_tip("To proceed select the <div style='font-weight:bold; display:inline'>Next Steps</div> tab below. To transfer raw materials to Finished Goods Warehouse click on <div style='font-weight:bold; display:inline'>" + next_step_list[i] +"</div>.");
|
||||
else cur_frm.append_tip("To update the quantity of finished goods and raw materials in their respective warehouses click on <div style='font-weight:bold; display:inline'>" + next_step_list[i] + "</div>.");
|
||||
}
|
||||
cur_frm.append_tip("(To amend this "+ cur_frm.doctype + " click on the <div style='font-weight:bold; display:inline'>Cancel</div> button above.)");
|
||||
}
|
||||
|
||||
// execute when doc is amended
|
||||
else if(doc.docstatus==2){
|
||||
cur_frm.set_tip("To make this " + cur_frm.doctype + " editable click on the <div style='font-weight:bold; display:inline'>Amend</div> button above.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Execute if current doctype is Production Planning Tool
|
||||
// ======================================================
|
||||
cur_frm.cscript.get_PPT_tips = function(doc, cdt, cdn)
|
||||
{
|
||||
cur_frm.set_tip('Welcome to Production Planning Wizard. This helps you to raise production order and see your raw material status as you plan your production.');
|
||||
cur_frm.append_tip("To start fetch all open Production Orders and Sales Orders by clicking on the <div style='font-weight:bold; display:inline'>Get Open Documents</div> button in the <div style='font-weight:bold; display:inline'>Against Document</div> tab below");
|
||||
|
||||
cur_frm.cscript['Get Open Documents'] = function(doc, cdt, cdn){
|
||||
cur_frm.set_tip("To include the required orders in the Production Plan check mark the <div style='font-weight:bold; display:inline'>Include In Plan</div> cell below.");
|
||||
cur_frm.append_tip("Next you can go to the <div style='font-weight:bold; display:inline'>Items</div> tab and click on <div style='font-weight:bold; display:inline'>Get Items</div> button to fetch the items of the selected orders.");
|
||||
}
|
||||
|
||||
cur_frm.cscript['Get Items'] = function(doc, cdt, cdn){
|
||||
cur_frm.set_tip("Now to raise a Production Order just click on <div style='font-weight:bold; display:inline'>Raise Production Ordre</div> button below the table.");
|
||||
cur_frm.append_tip("In order to see the Raw Material Report click on <div style='font-weight:bold; display:inline'>Get Raw Material Report</div> button below the table.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Executes when doc is edit status of doc is changed
|
||||
// ==================================================
|
||||
cur_frm.cscript.edit_status_changed = function(doc, cdt, cdn){
|
||||
cur_frm.cscript.get_tips();
|
||||
}
|
@ -22,66 +22,9 @@ class DocType:
|
||||
self.doc, self.doclist = d,dl
|
||||
self.last_profile = None
|
||||
|
||||
# Sync Profile with Gateway
|
||||
# -------------------------
|
||||
def sync_with_gateway(self,pid):
|
||||
p = Document('Profile',pid)
|
||||
|
||||
# login to gateway
|
||||
from webnotes.utils.webservice import FrameworkServer
|
||||
fw = FrameworkServer('www.erpnext.com','/','__system@webnotestech.com','password',https=1)
|
||||
|
||||
account_id = sql("select value from tabSingles where doctype='Control Panel' and field='account_id'")[0][0]
|
||||
|
||||
# call add profile
|
||||
ret = fw.runserverobj('Profile Control','Profile Control','add_profile_gateway',str([p.first_name, p.middle_name, p.last_name, p.email, p.name, account_id]))
|
||||
|
||||
if ret.get('exc'):
|
||||
msgprint(ret['exc'])
|
||||
raise Exception
|
||||
|
||||
def get_role_permission(self,role):
|
||||
perm = sql("select distinct t1.`parent`, t1.`read`, t1.`write`, t1.`create`, t1.`submit`,t1.`cancel`,t1.`amend` from `tabDocPerm` t1, `tabDocType` t2 where t1.`role` ='%s' and t1.docstatus !=2 and t1.permlevel = 0 and t1.`read` = 1 and t2.module != 'Recycle Bin' and t1.parent=t2.name "%role)
|
||||
return perm or ''
|
||||
|
||||
|
||||
# Check if password is expired
|
||||
# --------------------------------
|
||||
def has_pwd_expired(self):
|
||||
if session['user'] != 'Administrator' and session['user'].lower() != 'demo':
|
||||
last_pwd_date = None
|
||||
try:
|
||||
last_pwd_date = sql("select password_last_updated from tabProfile where name=%s",session['user'])[0][0] or ''
|
||||
except:
|
||||
return 'No'
|
||||
if cstr(last_pwd_date) == '':
|
||||
sql("update tabProfile set password_last_updated = '%s' where name='%s'"% (nowdate(),session['user']))
|
||||
return 'No'
|
||||
else:
|
||||
date_diff = (getdate(nowdate()) - last_pwd_date).days
|
||||
expiry_period = sql("select value from tabSingles where doctype='Control Panel' and field='password_expiry_days'")
|
||||
if expiry_period and cint(expiry_period[0][0]) and cint(expiry_period[0][0]) < date_diff:
|
||||
return 'Yes'
|
||||
return 'No'
|
||||
|
||||
def reset_password(self,pwd):
|
||||
if sql("select name from tabProfile where password=PASSWORD(%s) and name=%s", (pwd,session['user'])):
|
||||
return 'Password cannot be same as old password'
|
||||
sql("update tabProfile set password=PASSWORD(%s),password_last_updated=%s where name = %s", (pwd,nowdate(),session['user']))
|
||||
return 'ok'
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------
|
||||
#functions for manage user page
|
||||
#-----------Enable/Disable Profile-----------------------------------------------------------------------------------------------
|
||||
def change_login(self,args):
|
||||
args = eval(args)
|
||||
|
||||
if cint(args['set_disabled'])==0:
|
||||
sql("update `tabProfile` set enabled=1 where name='%s'"%args['user'])
|
||||
else:
|
||||
sql("update `tabProfile` set enabled=0 where name='%s'"%args['user'])
|
||||
|
||||
return 'ok'
|
||||
|
||||
#------------return role list -------------------------------------------------------------------------------------------------
|
||||
# All roles of Role Master
|
||||
@ -113,75 +56,3 @@ class DocType:
|
||||
pr.parentfield = 'userroles'
|
||||
pr.save(1)
|
||||
|
||||
|
||||
|
||||
# Add new member
|
||||
# ---------------
|
||||
def add_profile(self,arg):
|
||||
|
||||
# Check credit balance
|
||||
get_obj('WN ERP Client Control').check_credit_balance()
|
||||
|
||||
arg=eval(arg)
|
||||
pr=Document('Profile')
|
||||
for d in arg.keys():
|
||||
if d!='role':
|
||||
pr.fields[d] = arg[d]
|
||||
|
||||
pr.enabled=0
|
||||
pr.user_type='System User'
|
||||
pr.save(1)
|
||||
pr_obj = get_obj('Profile',pr.name)
|
||||
if (pr.name):
|
||||
msg="New member is added"
|
||||
pr_obj.on_update()
|
||||
else:
|
||||
msg="Profile not created"
|
||||
|
||||
return cstr(msg)
|
||||
|
||||
# to find currently login user
|
||||
def current_login(self):
|
||||
cl_list=sql("select distinct user from tabSessions")
|
||||
if cl_list:
|
||||
cl_list=[x[0] for x in cl_list]
|
||||
|
||||
return cl_list
|
||||
|
||||
|
||||
# Remove Profile
|
||||
# ---------------
|
||||
def remove_profile(self, user):
|
||||
# delete profile
|
||||
webnotes.model.delete_doc('Profile',user)
|
||||
|
||||
# Update WN ERP Client Control
|
||||
sql("update tabSingles set value = value - 1 where field = 'total_users' and doctype = 'WN ERP Client Control'")
|
||||
|
||||
# login to gateway
|
||||
from webnotes.utils.webservice import FrameworkServer
|
||||
fw = FrameworkServer('www.erpnext.com','/','__system@webnotestech.com','password',https=1)
|
||||
|
||||
account_id = sql("select value from tabSingles where doctype='Control Panel' and field='account_id'")[0][0]
|
||||
|
||||
# call remove profile
|
||||
ret = fw.runserverobj('Profile Control','Profile Control','remove_app_sub',str([user, account_id, session['user']]))
|
||||
|
||||
if ret.get('exc'):
|
||||
msgprint(ret['exc'])
|
||||
raise Exception
|
||||
|
||||
return "User Removed Successfully"
|
||||
|
||||
|
||||
# Create Profile
|
||||
# ---------------
|
||||
def create_profile(self, email):
|
||||
if sql("select name from tabProfile where name = %s", email):
|
||||
sql("update tabProfile set docstatus = 0 where name = %s", email)
|
||||
else:
|
||||
pr = Document('Profile')
|
||||
pr.email = email
|
||||
pr.enabled=0
|
||||
pr.user_type='System User'
|
||||
pr.save(1)
|
||||
|
@ -1,30 +0,0 @@
|
||||
# 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
|
||||
|
||||
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):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def logout_sso(self):
|
||||
import webnotes
|
||||
import webnotes.utils.webservice
|
||||
|
||||
if session['data'].get('login_from'):
|
||||
sso = webnotes.utils.webservice.FrameworkServer(session['data'].get('login_from'), '/', '__system@webnotestech.com', 'password')
|
||||
sso.runserverobj('SSO Control', 'SSO Control', 'logout_user', session['user'])
|
@ -1,30 +0,0 @@
|
||||
# DocType, SSO Control
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:24',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-12-20 19:44:29',
|
||||
'modified_by': 'umair@iwebnotes.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'issingle': 1,
|
||||
'module': 'Utilities',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# DocType, SSO Control
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'SSO Control'
|
||||
}
|
||||
]
|
@ -1,141 +0,0 @@
|
||||
# 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
|
||||
|
||||
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, doc, doclist):
|
||||
self.doc, self.doclist = doc, doclist
|
||||
|
||||
|
||||
# Check End of Trial Period
|
||||
# -------------------------
|
||||
def trial_payment_reminders(self):
|
||||
if cint(self.doc.is_trial_account)==1:
|
||||
# Trial Period Expiry
|
||||
trial_end_date = add_days(self.doc.account_start_date, 30)
|
||||
days = date_diff(trial_end_date, nowdate())
|
||||
# check if trial period has expired
|
||||
if days < 10 and days >= 0 and has_common(['System Manager'],webnotes.user.get_roles()):
|
||||
return "Your Trial Period expires on '%s'. Please buy credits online using Manage Account." % (formatdate(trial_end_date))
|
||||
|
||||
# trial period has already expired
|
||||
elif days < 0 and days >= -6:
|
||||
extended_days = 7 + days
|
||||
return "Your Trial Period has expired on %s. However, your account will be live for %s days. Please contact your System Manager to buy credits." % (formatdate(trial_end_date),cstr(extended_days))
|
||||
elif not has_common(['Administrator'],webnotes.user.get_roles()) and days < -6:
|
||||
return "Stopped"
|
||||
|
||||
# Account is not a trial account
|
||||
else:
|
||||
return self.account_expiry_reminder()
|
||||
|
||||
|
||||
# Account Expiry Reminder
|
||||
# -----------------------
|
||||
def account_expiry_reminder(self):
|
||||
import webnotes.utils
|
||||
from datetime import datetime
|
||||
# Payment Reminder in case of not enough balance
|
||||
cr_reqd = cint(self.doc.total_users)
|
||||
days_left = cint(self.calc_days())
|
||||
# check if account balance is sufficient
|
||||
if cint(self.doc.credit_balance)<(cr_reqd):
|
||||
|
||||
# Difference between last payment date and current date
|
||||
if self.doc.last_deduction_date: last_payment = date_diff(nowdate(),self.doc.last_deduction_date)
|
||||
else: last_payment = -1
|
||||
|
||||
# 7 days extension
|
||||
remaining_days = days_left - 24
|
||||
if last_payment > 30 or last_payment == -1:
|
||||
if remaining_days < 8 and remaining_days >= 1:
|
||||
return "Your account will be de-activated in " + cstr(remaining_days) + " days. Please contact your System Manager to buy credits."
|
||||
elif remaining_days==0:
|
||||
return "Your account will be disabled from tomorrow. Please contact your System Manager to buy credits."
|
||||
elif not has_common(['Administrator'],webnotes.user.get_roles()):
|
||||
return "Stopped"
|
||||
|
||||
# check if user account is extended for seven days
|
||||
if cint(self.doc.is_trial_account)==0:
|
||||
if days_left < 10 and days_left >= 0:
|
||||
return "You have only %s Credits in your account. Buy credits before %s." % (cint(self.doc.credit_balance),formatdate(self.next_bill_sdate))
|
||||
|
||||
|
||||
|
||||
# Calculate days between current date and billing cycle end date
|
||||
# --------------------------------------------------------------
|
||||
def calc_days(self):
|
||||
if self.doc.billing_cycle_date:
|
||||
next_bill_month = cint(nowdate().split('-')[1])
|
||||
if cint(nowdate().split('-')[2]) > cint(self.doc.billing_cycle_date.split('-')[2]):
|
||||
next_bill_month = cint(nowdate().split('-')[1]) + 1
|
||||
next_bill_year = nowdate().split('-')[0]
|
||||
if next_bill_month > 12:
|
||||
next_bill_month = next_bill_month % 12
|
||||
next_bill_year += 1
|
||||
self.next_bill_sdate = cstr(next_bill_year)+'-'+cstr(next_bill_month)+'-'+(self.calc_next_day(next_bill_year,next_bill_month))
|
||||
#msgprint("next_bill_month :::" + self.next_bill_sdate)
|
||||
return date_diff(self.next_bill_sdate, nowdate())
|
||||
|
||||
|
||||
# Calculate next billing date day
|
||||
# --------------------------------
|
||||
def calc_next_day(self, next_year, next_month):
|
||||
bill_cycle_day = cstr(self.doc.billing_cycle_date).split('-')[2]
|
||||
if cint(next_month) == 2 and next_year%4==0 and (next_year%100!=0 or next_year%400==0) and cint(bill_cycle_day) > 28:
|
||||
bill_cycle_day = '28'
|
||||
elif cint(bill_cycle_day) == 31 and cint(next_month) in (4,6,9,11):
|
||||
bill_cycle_day = '30'
|
||||
return bill_cycle_day
|
||||
|
||||
|
||||
# Update acc credits and balance (making payment from gateway)
|
||||
# -------------------------------------------------------------
|
||||
def update_acc_bal(self,args):
|
||||
args = eval(args)
|
||||
self.doc.credit_balance = cint(self.doc.credit_balance) + cint(args.get('net_cr'))
|
||||
self.doc.total_users = cint(self.doc.total_users) + cint(args.get('total_users'))
|
||||
if cint(self.doc.is_trial_account) == 1:
|
||||
if not self.doc.account_start_date:
|
||||
self.doc.account_start_date = nowdate()
|
||||
self.doc.is_trial_account = 0
|
||||
self.doc.billing_cycle_date = nowdate()
|
||||
self.doc.last_deduction_date = nowdate()
|
||||
self.doc.save()
|
||||
|
||||
|
||||
# Check Credit Balance
|
||||
# ---------------------
|
||||
def check_credit_balance(self):
|
||||
if cint(self.doc.is_trial_account) == 0:
|
||||
if cint(self.doc.credit_balance) < 1:
|
||||
msgprint("You do not have enough credits to add new user. Please buy credits.")
|
||||
raise Exception
|
||||
else:
|
||||
self.doc.credit_balance = cint(self.doc.credit_balance) - 1
|
||||
msgprint("Your one credit is consumed. Balance Credits : %s" % (self.doc.credit_balance))
|
||||
self.doc.total_users = cint(self.doc.total_users) + 1
|
||||
self.doc.save()
|
||||
|
||||
|
||||
# Monthly Deduction
|
||||
# ------------------
|
||||
def monthly_deduction(self, cr_ded):
|
||||
self.doc.credit_balance = cint(self.doc.credit_balance) - cint(cr_ded)
|
||||
self.doc.last_deduction_date = nowdate()
|
||||
self.doc.save()
|
@ -1,124 +0,0 @@
|
||||
# DocType, WN ERP Client Control
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:30',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'issingle': 1,
|
||||
'istable': 0,
|
||||
'module': 'Utilities',
|
||||
'name': '__common__',
|
||||
'read_only': 1,
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 1,
|
||||
'version': 137
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'WN ERP Client Control',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'WN ERP Client Control',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1,
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocType, WN ERP Client Control
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'WN ERP Client Control'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'account_start_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 1,
|
||||
'label': 'Account Start Date'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'billing_cycle_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 2,
|
||||
'label': 'Billing Cycle Date'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'total_users',
|
||||
'fieldtype': 'Int',
|
||||
'idx': 3,
|
||||
'label': 'Total Users'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'credit_balance',
|
||||
'fieldtype': 'Int',
|
||||
'idx': 4,
|
||||
'label': 'Credit Balance'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'is_trial_account',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 5,
|
||||
'label': 'Is Trial Account'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'last_deduction_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 6,
|
||||
'label': 'Last Credit Deduction Date'
|
||||
}
|
||||
]
|
@ -1,2 +1,4 @@
|
||||
<div id="trash_header"> </div>
|
||||
<div id="trash_div" style="margin: 0px;"> </div>
|
||||
<div class="layout_wrapper">
|
||||
<div id="trash_header"></div>
|
||||
<div id="trash_div" style="margin: 0px;"></div>
|
||||
</div>
|
142
erpnext/website/Module Def/Website/Website.txt
Normal file
142
erpnext/website/Module Def/Website/Website.txt
Normal file
@ -0,0 +1,142 @@
|
||||
# Module Def, Website
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-23 17:05:32',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-02-02 13:23:41',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Module Def Role
|
||||
{
|
||||
'doctype': 'Module Def Role',
|
||||
'name': '__common__',
|
||||
'parent': 'Website',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
|
||||
# These values are common for all Module Def Item
|
||||
{
|
||||
'doctype': 'Module Def Item',
|
||||
'name': '__common__',
|
||||
'parent': 'Website',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
|
||||
# These values are common for all Module Def
|
||||
{
|
||||
'disabled': 'No',
|
||||
'doctype': u'Module Def',
|
||||
'is_hidden': 'No',
|
||||
'module_label': 'Website',
|
||||
'module_name': 'Website',
|
||||
'name': '__common__'
|
||||
},
|
||||
|
||||
# Module Def, Website
|
||||
{
|
||||
'doctype': u'Module Def',
|
||||
'name': 'Website'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Web Page',
|
||||
'doc_name': 'Web Page',
|
||||
'doc_type': 'Forms',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Product',
|
||||
'doc_name': 'Product',
|
||||
'doc_type': 'Forms',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Blog',
|
||||
'doc_name': 'Blog',
|
||||
'doc_type': 'Forms',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Style Settings',
|
||||
'doc_name': 'Style Settings',
|
||||
'doc_type': 'Single DocType',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Website Settings',
|
||||
'doc_name': 'Website Settings',
|
||||
'doc_type': 'Single DocType',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Home Settings',
|
||||
'doc_name': 'Home Settings',
|
||||
'doc_type': 'Single DocType',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'About Us Settings',
|
||||
'doc_name': 'About Us Settings',
|
||||
'doc_type': 'Single DocType',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Contact Us Settings',
|
||||
'doc_name': 'Contact Us Settings',
|
||||
'doc_type': 'Single DocType',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Products Settings',
|
||||
'doc_name': 'Products Settings',
|
||||
'doc_type': 'Single DocType',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Role
|
||||
{
|
||||
'doctype': 'Module Def Role',
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# Module Def Role
|
||||
{
|
||||
'doctype': 'Module Def Role',
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# Module Def Role
|
||||
{
|
||||
'doctype': 'Module Def Role',
|
||||
'role': 'Website Manager'
|
||||
},
|
||||
|
||||
# Module Def Role
|
||||
{
|
||||
'doctype': 'Module Def Role',
|
||||
'role': 'Website Manager'
|
||||
}
|
||||
]
|
26
erpnext/website/Role/Blogger/Blogger.txt
Normal file
26
erpnext/website/Role/Blogger/Blogger.txt
Normal file
@ -0,0 +1,26 @@
|
||||
# Role, Blogger
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-27 12:22:24',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-27 12:22:24',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Role
|
||||
{
|
||||
'doctype': 'Role',
|
||||
'module': u'Website',
|
||||
'name': '__common__',
|
||||
'role_name': u'Blogger'
|
||||
},
|
||||
|
||||
# Role, Blogger
|
||||
{
|
||||
'doctype': 'Role',
|
||||
'name': u'Blogger'
|
||||
}
|
||||
]
|
26
erpnext/website/Role/Website Manager/Website Manager.txt
Normal file
26
erpnext/website/Role/Website Manager/Website Manager.txt
Normal file
@ -0,0 +1,26 @@
|
||||
# Role, Website Manager
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-24 10:18:47',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-02-06 15:22:27',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Role
|
||||
{
|
||||
'doctype': 'Role',
|
||||
'module': u'Website',
|
||||
'name': '__common__',
|
||||
'role_name': u'Website Manager'
|
||||
},
|
||||
|
||||
# Role, Website Manager
|
||||
{
|
||||
'doctype': 'Role',
|
||||
'name': u'Website Manager'
|
||||
}
|
||||
]
|
125
erpnext/website/css/website.css
Normal file
125
erpnext/website/css/website.css
Normal file
@ -0,0 +1,125 @@
|
||||
#body_div {
|
||||
width: 900px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.layout_wrapper {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: #F8F8F8;
|
||||
border: 1px solid #CCCCCC;
|
||||
border-radius: 3px 3px 3px 3px;
|
||||
font-size: 13px;
|
||||
line-height: 19px;
|
||||
overflow: auto;
|
||||
padding: 6px 10px;
|
||||
margin-bottom: 9px;
|
||||
}
|
||||
|
||||
footer {
|
||||
width: 900px;
|
||||
margin: auto;
|
||||
}
|
||||
header .topbar .container {
|
||||
width: 900px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.web-head-section {
|
||||
margin-bottom: 20px
|
||||
}
|
||||
|
||||
.web-content input[type="text"], .web-content input[type="password"], .web-content select {
|
||||
min-width: 180px;
|
||||
}
|
||||
|
||||
.web-main-section {
|
||||
width: 65%;
|
||||
float: left;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.web-main-section p,
|
||||
.web-main-section h4,
|
||||
.web-main-section h5,
|
||||
.web-main-section pre {
|
||||
margin-left: 9px;
|
||||
}
|
||||
|
||||
.web-side-section {
|
||||
width: 30%;
|
||||
float: right;
|
||||
margin-bottom: 20px;
|
||||
margin-right: 15px;
|
||||
color: #606060;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.web-page-status {
|
||||
padding: 7px;
|
||||
color: #777;
|
||||
clear: both;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.web-page-status a,
|
||||
.web-page-status a:hover,
|
||||
.web-page-status a:visited {
|
||||
padding: 2px;
|
||||
background-color: #777;
|
||||
color: #FFF;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.web-page-status a:hover {
|
||||
background-color: #444;
|
||||
}
|
||||
|
||||
footer {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.web-footer {
|
||||
color: inherit;
|
||||
text-align: center;
|
||||
margin: 10px;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.web-footer div, .web-footer a {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.web-footer-menu {
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
footer a, footer a:visited {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
footer a:hover {
|
||||
background-color: #777;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.web-footer-menu ul {
|
||||
list-style: none;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.web-footer-menu ul li {
|
||||
display: inline;
|
||||
padding: 2px 15px;
|
||||
border-right: 1px solid #999;
|
||||
}
|
||||
|
||||
.web-footer-menu ul li:last-child {
|
||||
border-right: 0px solid #777 !important;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
"""
|
||||
generate html
|
||||
"""
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def on_update(self):
|
||||
"""make home html"""
|
||||
from website.utils import make_template
|
||||
import os
|
||||
path = os.path.join(os.path.dirname(__file__), 'template.html')
|
||||
|
||||
self.doc.about_team = webnotes.conn.sql("""select * from `tabAbout Us Team`
|
||||
where parent='About Us Settings' order by idx""", as_dict=1)
|
||||
|
||||
import markdown2
|
||||
for t in self.doc.about_team:
|
||||
t['bio'] = markdown2.markdown(t.get('bio') or '')
|
||||
|
||||
webnotes.conn.set_value('Page', 'about', 'title', self.doc.headline)
|
||||
webnotes.conn.set_value('Page', 'about', 'content', make_template(self.doc, path))
|
106
erpnext/website/doctype/about_us_settings/about_us_settings.txt
Normal file
106
erpnext/website/doctype/about_us_settings/about_us_settings.txt
Normal file
@ -0,0 +1,106 @@
|
||||
# DocType, About Us Settings
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-27 10:13:16',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-27 11:36:44',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1327641155',
|
||||
'allow_attach': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'issingle': 1,
|
||||
'max_attachments': 10,
|
||||
'module': 'Website',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 4
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'About Us Settings',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'About Us Settings',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'Website Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocType, About Us Settings
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'About Us Settings'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'headline',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Headline'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'main_section',
|
||||
'fieldtype': 'Code',
|
||||
'label': 'Main Section'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'team',
|
||||
'fieldtype': 'Table',
|
||||
'label': 'Team',
|
||||
'options': 'About Us Team'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'side_section',
|
||||
'fieldtype': 'Code',
|
||||
'label': 'Side Section'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'file_list',
|
||||
'fieldtype': 'Text',
|
||||
'hidden': 1,
|
||||
'label': 'File List',
|
||||
'no_copy': 1,
|
||||
'print_hide': 1
|
||||
}
|
||||
]
|
36
erpnext/website/doctype/about_us_settings/template.html
Normal file
36
erpnext/website/doctype/about_us_settings/template.html
Normal file
@ -0,0 +1,36 @@
|
||||
<div class="layout_wrapper">
|
||||
<div class="web-content" id="content-about-us">
|
||||
{% if doc.headline %}
|
||||
<h1>{{ doc.headline }}</h1>
|
||||
{% endif %}
|
||||
<div class="web-main-section">
|
||||
{{ doc.main_section_html }}
|
||||
|
||||
{% if doc.about_team %}
|
||||
<h2>Team</h2>
|
||||
<table style="width: 90%">
|
||||
<tbody>
|
||||
{% for p in doc.about_team %}
|
||||
<tr>
|
||||
<td style="width: 110px">
|
||||
<img src="files/{{ p.image }}"
|
||||
style="width: 100px; margin-right: 10px;
|
||||
margin-bottom: 15px;" />
|
||||
</td>
|
||||
<td>
|
||||
<h4>{{ p.person_name }}</h4>
|
||||
<p class="field_description">{{ p.designation }}</p>
|
||||
<div style="margin-bottom: 15px">{{ p.bio }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="web-side-section">
|
||||
{{ doc.side_section_html }}
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
</div>
|
74
erpnext/website/doctype/about_us_team/about_us_team.txt
Normal file
74
erpnext/website/doctype/about_us_team/about_us_team.txt
Normal file
@ -0,0 +1,74 @@
|
||||
# DocType, About Us Team
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-27 10:14:18',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-27 11:54:18',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Website',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 5
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'About Us Team',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocType, About Us Team
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'About Us Team'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'person_name',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Person Name'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'designation',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Designation'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'image',
|
||||
'fieldtype': 'Select',
|
||||
'label': 'Image',
|
||||
'options': 'attach_files:'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'bio',
|
||||
'fieldtype': 'Text',
|
||||
'label': 'Bio (markdown)',
|
||||
'width': '300px'
|
||||
}
|
||||
]
|
0
erpnext/website/doctype/blog/__init__.py
Normal file
0
erpnext/website/doctype/blog/__init__.py
Normal file
48
erpnext/website/doctype/blog/blog.py
Normal file
48
erpnext/website/doctype/blog/blog.py
Normal file
@ -0,0 +1,48 @@
|
||||
"""
|
||||
record of files
|
||||
|
||||
naming for same name files: file.gif, file-1.gif, file-2.gif etc
|
||||
"""
|
||||
|
||||
import webnotes
|
||||
import website.utils
|
||||
|
||||
class DocType():
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def autoname(self):
|
||||
"""save file by its name"""
|
||||
self.doc.name = website.utils.page_name(self.doc.title)
|
||||
|
||||
def validate(self):
|
||||
"""write/update 'Page' with the blog"""
|
||||
p = website.utils.add_page(self.doc.title)
|
||||
self.doc.name = p.name
|
||||
|
||||
from jinja2 import Template
|
||||
import markdown2
|
||||
import os
|
||||
from webnotes.utils import global_date_format, get_full_name
|
||||
|
||||
self.doc.content_html = markdown2.markdown(self.doc.content or '')
|
||||
self.doc.full_name = get_full_name(self.doc.owner)
|
||||
self.doc.updated = global_date_format(self.doc.modified)
|
||||
|
||||
with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
|
||||
p.content = Template(f.read()).render(doc=self.doc)
|
||||
|
||||
with open(os.path.join(os.path.dirname(__file__), 'blog_page.js'), 'r') as f:
|
||||
p.script = Template(f.read()).render(doc=self.doc)
|
||||
|
||||
p.save()
|
||||
|
||||
website.utils.add_guest_access_to_page(p.name)
|
||||
|
||||
# cleanup
|
||||
for f in ['content_html', 'full_name', 'updated']:
|
||||
if f in self.doc.fields:
|
||||
del self.doc.fields[f]
|
||||
|
||||
|
||||
|
124
erpnext/website/doctype/blog/blog.txt
Normal file
124
erpnext/website/doctype/blog/blog.txt
Normal file
@ -0,0 +1,124 @@
|
||||
# DocType, Blog
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-27 12:24:03',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-02-07 13:55:17',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': u'1328599743',
|
||||
'allow_attach': 1,
|
||||
'colour': u'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'max_attachments': 5,
|
||||
'module': u'Website',
|
||||
'name': '__common__',
|
||||
'section_style': u'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 3
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'name': '__common__',
|
||||
'parent': u'Blog',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': u'Blog',
|
||||
'parentfield': u'permissions',
|
||||
'parenttype': u'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Blog
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': u'Blog'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Website Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Blogger',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'All'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'title',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Title',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'published',
|
||||
'fieldtype': u'Check',
|
||||
'label': u'Published',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'content',
|
||||
'fieldtype': u'Code',
|
||||
'label': u'Content',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'content_html',
|
||||
'fieldtype': u'Text',
|
||||
'label': u'Preview',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'file_list',
|
||||
'fieldtype': u'Text',
|
||||
'hidden': 1,
|
||||
'label': u'File List',
|
||||
'no_copy': 1,
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
}
|
||||
]
|
71
erpnext/website/doctype/blog/blog_page.js
Normal file
71
erpnext/website/doctype/blog/blog_page.js
Normal file
@ -0,0 +1,71 @@
|
||||
// js inside blog page
|
||||
|
||||
pscript['onload_{{ doc.name }}'] = function(wrapper) {
|
||||
// sidebar
|
||||
var side = $(wrapper).find('.web-side-section')
|
||||
.append('<h4>Recent Posts</h4>').get(0);
|
||||
|
||||
wrapper.recent_list = new wn.widgets.Listing({
|
||||
parent: side,
|
||||
query: 'select name, title, left(content, 100) as content from tabBlog\
|
||||
where ifnull(published,1)=1',
|
||||
hide_refresh: true,
|
||||
render_row: function(parent, data) {
|
||||
if(data.content.length==100) data.content += '...';
|
||||
parent.innerHTML = repl('<a href="#!%(name)s">%(title)s</a>\
|
||||
<div class="comment">%(content)s</div><br>', data);
|
||||
},
|
||||
page_length: 5
|
||||
});
|
||||
wrapper.recent_list.run();
|
||||
|
||||
|
||||
// comments
|
||||
$(wrapper).find('.web-main-section').append('<h3>Comments</h3>');
|
||||
|
||||
wrapper.comment_list = new wn.widgets.Listing({
|
||||
parent: $(wrapper).find('.web-main-section').get(0),
|
||||
query: 'select comment, comment_by_fullname, modified\
|
||||
from `tabComment Widget Record` where comment_doctype="Page"\
|
||||
and comment_docname="{{ doc.name }}"',
|
||||
no_result_message: 'Be the first one to comment',
|
||||
render_row: function(parent, data) {
|
||||
data.comment_date = prettyDate(data.modified);
|
||||
$(parent).html(repl("<div style='color:#777'>\
|
||||
%(comment_by_fullname)s | %(comment_date)s:\
|
||||
</div>\
|
||||
<p style='margin-left: 20px;'>%(comment)s</p><br>", data))
|
||||
},
|
||||
hide_refresh: true
|
||||
});
|
||||
wrapper.comment_list.run();
|
||||
|
||||
// add comment
|
||||
$(wrapper).find('.web-main-section').append('<br><button class="btn add-comment">\
|
||||
Add Comment</button>');
|
||||
$(wrapper).find('button.add-comment').click(function(){
|
||||
d = new wn.widgets.Dialog({
|
||||
title: 'Add Comment',
|
||||
fields: [
|
||||
{fieldname:'comment_by_fullname', label:'Your Name', reqd:1, fieldtype:'Data'},
|
||||
{fieldname:'comment_by', label:'Email Id', reqd:1, fieldtype:'Data'},
|
||||
{fieldname:'comment', label:'Comment', reqd:1, fieldtype:'Text'},
|
||||
{fieldname:'post', label:'Post', fieldtype:'Button'}
|
||||
]
|
||||
});
|
||||
d.fields_dict.post.input.onclick = function() {
|
||||
var btn = this;
|
||||
var args = d.get_values();
|
||||
if(!args) return;
|
||||
args.comment_doctype = 'Page';
|
||||
args.comment_docname = '{{ doc.name }}';
|
||||
$(btn).set_working();
|
||||
$c('webnotes.widgets.form.comments.add_comment', args, function(r) {
|
||||
$(btn).done_working();
|
||||
d.hide();
|
||||
wrapper.comment_list.refresh();
|
||||
})
|
||||
}
|
||||
d.show();
|
||||
})
|
||||
}
|
20
erpnext/website/doctype/blog/template.html
Normal file
20
erpnext/website/doctype/blog/template.html
Normal file
@ -0,0 +1,20 @@
|
||||
<div class="layout_wrapper">
|
||||
<div class="web-content" id="blog-{{ doc.name }}">
|
||||
<h1>Blog</h1>
|
||||
<div class="web-main-section">
|
||||
<h3>{{ doc.title }}</h3>
|
||||
<div class="help">By {{ doc.full_name }} on {{ doc.updated }}</div>
|
||||
<br>
|
||||
{{ doc.content_html }}
|
||||
</div>
|
||||
<div class="web-side-section">
|
||||
<p><a href="#!blog">All Blogs</a></p>
|
||||
<h4>Subscribe</h4>
|
||||
<p>
|
||||
<img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
|
||||
<a href="rss.xml" target="_blank">RSS Feed</a>
|
||||
</p>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
</div>
|
0
erpnext/website/doctype/blog_subscriber/__init__.py
Normal file
0
erpnext/website/doctype/blog_subscriber/__init__.py
Normal file
@ -1,11 +1,11 @@
|
||||
# DocType, Production Tips Common
|
||||
# DocType, Blog Subscriber
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:14',
|
||||
'creation': '2012-01-27 17:18:33',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified': '2012-01-27 17:18:33',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
@ -14,17 +14,16 @@
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'issingle': 1,
|
||||
'module': 'Utilities',
|
||||
'module': 'Website',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'version': 37
|
||||
'show_in_menu': 0,
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# DocType, Production Tips Common
|
||||
# DocType, Blog Subscriber
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Production Tips Common'
|
||||
'name': 'Blog Subscriber'
|
||||
}
|
||||
]
|
@ -0,0 +1,17 @@
|
||||
"""
|
||||
generate html
|
||||
"""
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def on_update(self):
|
||||
"""make home html"""
|
||||
from website.utils import make_template
|
||||
import os
|
||||
path = os.path.join(os.path.dirname(__file__), 'template.html')
|
||||
|
||||
webnotes.conn.set_value('Page', 'contact', 'title', self.doc.headline)
|
||||
webnotes.conn.set_value('Page', 'contact', 'content', make_template(self.doc, path))
|
@ -0,0 +1,100 @@
|
||||
# DocType, Contact Us Settings
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-25 16:01:33',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-25 16:01:33',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Other',
|
||||
'issingle': 1,
|
||||
'module': 'Website',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Contact Us Settings',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Contact Us Settings',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocType, Contact Us Settings
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Contact Us Settings'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'role': 'Website Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': 'Contact Us',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'headline',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Headline'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'send_email_notification',
|
||||
'fieldtype': 'Check',
|
||||
'label': 'Send Email Notification'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'main_section',
|
||||
'fieldtype': 'Code',
|
||||
'label': 'Main Section'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'side_section',
|
||||
'fieldtype': 'Code',
|
||||
'label': 'Side Section'
|
||||
}
|
||||
]
|
24
erpnext/website/doctype/contact_us_settings/template.html
Normal file
24
erpnext/website/doctype/contact_us_settings/template.html
Normal file
@ -0,0 +1,24 @@
|
||||
<div class="layout_wrapper">
|
||||
<div class="web-content" id="content-contact-us">
|
||||
{% if doc.headline %}
|
||||
<h1>{{ doc.headline }}</h1>
|
||||
{% endif %}
|
||||
<div class="web-main-section">
|
||||
<label>Your Name*</label>
|
||||
<div><input name="contact-name" type="text"/></div>
|
||||
<br>
|
||||
<label>Email*</label>
|
||||
<div><input name="contact-email" type="text"/></div>
|
||||
<br>
|
||||
<label>Message*</label>
|
||||
<div><textarea name="contact-message" style="height: 200px"></textarea></div>
|
||||
<br>
|
||||
<div><button class="btn primary">Send</button></div>
|
||||
{{ doc.main_section_html }}
|
||||
</div>
|
||||
<div class="web-side-section">
|
||||
{{ doc.side_section_html }}
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
</div>
|
0
erpnext/website/doctype/product/__init__.py
Normal file
0
erpnext/website/doctype/product/__init__.py
Normal file
6
erpnext/website/doctype/product/product.js
Normal file
6
erpnext/website/doctype/product/product.js
Normal file
@ -0,0 +1,6 @@
|
||||
$.extend(cur_frm.cscript, {
|
||||
onload: function() {
|
||||
cur_frm.add_fetch('item', 'description', 'short_description');
|
||||
cur_frm.add_fetch('item', 'item_name', 'title');
|
||||
}
|
||||
});
|
41
erpnext/website/doctype/product/product.py
Normal file
41
erpnext/website/doctype/product/product.py
Normal file
@ -0,0 +1,41 @@
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def validate(self):
|
||||
"""make page for this product"""
|
||||
import website.utils
|
||||
|
||||
p = website.utils.add_page("Product " + self.doc.title)
|
||||
|
||||
from jinja2 import Template
|
||||
import markdown2
|
||||
import os
|
||||
|
||||
self.doc.item_group = webnotes.conn.get_value('Item', self.doc.item, 'item_group')
|
||||
self.doc.long_description_html = markdown2.markdown(self.doc.long_description or '')
|
||||
|
||||
with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
|
||||
p.content = Template(f.read()).render(doc=self.doc)
|
||||
|
||||
with open(os.path.join(os.path.dirname(__file__), 'product_page.js'), 'r') as f:
|
||||
p.script = Template(f.read()).render(doc=self.doc)
|
||||
|
||||
p.save()
|
||||
|
||||
website.utils.add_guest_access_to_page(p.name)
|
||||
self.doc.page_name = p.name
|
||||
self.make_item_group_active()
|
||||
|
||||
del self.doc.fields['long_description_html']
|
||||
del self.doc.fields['item_group']
|
||||
|
||||
def make_item_group_active(self):
|
||||
"""show item group in website"""
|
||||
if self.doc.published:
|
||||
from webnotes.model.doc import Document
|
||||
ig = Document('Item Group', self.doc.item_group)
|
||||
ig.show_in_website = 1
|
||||
ig.save()
|
251
erpnext/website/doctype/product/product.txt
Normal file
251
erpnext/website/doctype/product/product.txt
Normal file
@ -0,0 +1,251 @@
|
||||
# DocType, Product
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-30 16:21:29',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-02-06 16:15:29',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': u'1327997783',
|
||||
'allow_attach': 1,
|
||||
'autoname': u'field:item',
|
||||
'colour': u'White:FFF',
|
||||
'description': u'A Product is shown on the website and is linked to an item.',
|
||||
'doctype': 'DocType',
|
||||
'max_attachments': 5,
|
||||
'module': u'Website',
|
||||
'name': '__common__',
|
||||
'section_style': u'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 11
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'name': '__common__',
|
||||
'parent': u'Product',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': u'Product',
|
||||
'parentfield': u'permissions',
|
||||
'parenttype': u'DocType',
|
||||
'read': 1,
|
||||
'role': u'Website Manager'
|
||||
},
|
||||
|
||||
# DocType, Product
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': u'Product'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'item',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Item',
|
||||
'options': u'Item',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'title',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Title',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'published',
|
||||
'fieldtype': u'Check',
|
||||
'label': u'Published',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Select Price List for the web. Leave blank to hide price.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'price_list',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Price List',
|
||||
'options': u'Price List',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Select shipping warehouse to show "In Stock" or "Out of Stock". To hide, leave blank',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'warehouse',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Warehouse',
|
||||
'options': u'Warehouse',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldtype': u'Column Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Image for listing (Width: 100px) (Attach First)',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'thumbnail_image',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Thumbnail Image',
|
||||
'options': u'attach_files:',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Image for listing (Width: 300px) (Attach First)',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'full_image',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Full Image',
|
||||
'options': u'attach_files:',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'short_description',
|
||||
'fieldtype': u'Text',
|
||||
'label': u'Short Description',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldtype': u'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Full description (formatted as markdown)',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'long_description',
|
||||
'fieldtype': u'Code',
|
||||
'label': u'Long Description',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldtype': u'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'page_name',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Page Name',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'price',
|
||||
'fieldtype': u'Currency',
|
||||
'hidden': 0,
|
||||
'label': u'Price',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'sales',
|
||||
'fieldtype': u'Currency',
|
||||
'label': u'Sales',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'stock',
|
||||
'fieldtype': u'Currency',
|
||||
'label': u'Stock',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'currency',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Currency',
|
||||
'options': u'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'file_list',
|
||||
'fieldtype': u'Text',
|
||||
'hidden': 1,
|
||||
'label': u'File List',
|
||||
'no_copy': 1,
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
}
|
||||
]
|
47
erpnext/website/doctype/product/product_page.js
Normal file
47
erpnext/website/doctype/product/product_page.js
Normal file
@ -0,0 +1,47 @@
|
||||
wn.require('erpnext/website/js/product_category.js');
|
||||
|
||||
pscript["onload_{{ doc.page_name }}"] = function(wrapper) {
|
||||
wrapper.product_group = "{{ doc.item_group }}";
|
||||
wrapper.product_name = "{{ doc.name }}";
|
||||
erpnext.make_product_categories(wrapper);
|
||||
$(wrapper).find('.product-inquiry').click(function() {
|
||||
loadpage('contact', function() {
|
||||
$('#content-contact-us [name="contact-message"]').val("Hello,\n\n\
|
||||
Please send me more information on {{ doc.title }} (Item Code:{{ doc.item }})\n\n\
|
||||
My contact details are:\n\nThank you!\
|
||||
");
|
||||
})
|
||||
});
|
||||
|
||||
// similar products
|
||||
wrapper.similar = new wn.widgets.Listing({
|
||||
parent: $(wrapper).find('.similar-products').get(0),
|
||||
hide_refresh: true,
|
||||
page_length: 5,
|
||||
get_query: function() {
|
||||
args = {
|
||||
cat: wrapper.product_group,
|
||||
name: wrapper.product_name
|
||||
};
|
||||
return repl('select t1.name, t1.title, t1.thumbnail_image, \
|
||||
t1.page_name, t1.short_description \
|
||||
from tabProduct t1, tabItem t2 \
|
||||
where t1.item = t2.name \
|
||||
and ifnull(t1.published,0)=1 \
|
||||
and t1.name != "%(name)s" \
|
||||
and t2.item_group="%(cat)s" order by t1.modified desc', args)
|
||||
},
|
||||
render_row: function(parent, data) {
|
||||
if(data.short_description.length > 100) {
|
||||
data.short_description = data.short_description.substr(0,100) + '...';
|
||||
}
|
||||
parent.innerHTML = repl('<div style="float:left; width: 60px;">\
|
||||
<img src="files/%(thumbnail_image)s" style="width:55px;"></div>\
|
||||
<div style="float:left; width: 180px">\
|
||||
<b><a href="#!%(page_name)s">%(title)s</a></b>\
|
||||
<p>%(short_description)s</p></div>\
|
||||
<div style="clear: both; margin-bottom: 15px;"></div>', data);
|
||||
}
|
||||
});
|
||||
wrapper.similar.run();
|
||||
}
|
32
erpnext/website/doctype/product/template.html
Normal file
32
erpnext/website/doctype/product/template.html
Normal file
@ -0,0 +1,32 @@
|
||||
<div class="layout_wrapper">
|
||||
<div class="web-content" id="content-product-{{ doc.name }}">
|
||||
<h1>{{ doc.title }}</h1>
|
||||
<div class="web-main-section">
|
||||
<div style="float: left;">
|
||||
<image src="files/{{ doc.full_image }}" style="width: 300px;
|
||||
margin-left: 15px;" />
|
||||
{{ doc.long_description_html }}
|
||||
<button class="btn primary product-inquiry"
|
||||
data-product="{{ doc.name }}"
|
||||
data-description="{{ doc.short_description }}">Send Inquiry</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="web-side-section">
|
||||
<div class="info-box round">
|
||||
<p><b>Item Code:</b> {{ doc.item }}</p>
|
||||
<p>{{ doc.short_description }}</p>
|
||||
<p><button class="btn primary product-inquiry"
|
||||
data-product="{{ doc.name }}"
|
||||
data-description="{{ doc.short_description }}">Send Inquiry</button>
|
||||
</p>
|
||||
</div>
|
||||
<br>
|
||||
<h4>More Categories</h4>
|
||||
<div class="more-categories"></div>
|
||||
<br>
|
||||
<h4>Similar Products</h4>
|
||||
<div class="similar-products"></div>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
</div>
|
0
erpnext/website/doctype/product_group/__init__.py
Normal file
0
erpnext/website/doctype/product_group/__init__.py
Normal file
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user