New Setup Wizard

This commit is contained in:
Rushabh Mehta 2013-10-08 17:59:11 +05:30
parent 8941841a9c
commit 8c5a5f1ed5
16 changed files with 589 additions and 484 deletions

View File

@ -7,7 +7,7 @@ def execute():
webnotes.reload_doc("selling", "doctype", "shopping_cart_settings") webnotes.reload_doc("selling", "doctype", "shopping_cart_settings")
# create two default territories, one for home country and one named Rest of the World # create two default territories, one for home country and one named Rest of the World
from setup.doctype.setup_control.setup_control import create_territories from setup.page.setup_wizard.setup_wizard import create_territories
create_territories() create_territories()
webnotes.conn.set_value("Shopping Cart Settings", None, "default_territory", "Rest of the World") webnotes.conn.set_value("Shopping Cart Settings", None, "default_territory", "Rest of the World")

View File

@ -223,4 +223,5 @@ patch_list = [
"patches.october_2013.p01_update_delivery_note_prevdocs", "patches.october_2013.p01_update_delivery_note_prevdocs",
"patches.october_2013.p02_set_communication_status", "patches.october_2013.p02_set_communication_status",
"patches.october_2013.p03_crm_update_status", "patches.october_2013.p03_crm_update_status",
"execute:webnotes.delete_doc('DocType', 'Setup Control')",
] ]

View File

@ -1,126 +0,0 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
// License: GNU General Public License v3. See license.txt
// complete my company registration
// --------------------------------
wn.provide('erpnext.complete_setup');
$.extend(erpnext.complete_setup, {
show: function() {
d = erpnext.complete_setup.prepare_dialog();
d.show();
},
prepare_dialog: function() {
var d = new wn.ui.Dialog({
title: "Setup",
fields: [
{fieldname:'first_name', label:'Your First Name', fieldtype:'Data', reqd: 1},
{fieldname:'last_name', label:'Your Last Name', fieldtype:'Data'},
{fieldname:'company_name', label:'Company Name', fieldtype:'Data', reqd:1,
description: 'e.g. "My Company LLC"'},
{fieldname:'company_abbr', label:'Company Abbreviation', fieldtype:'Data',
description:'e.g. "MC"',reqd:1},
{fieldname:'fy_start', label:'Financial Year Start Date', fieldtype:'Select',
description:'Your financial year begins on"', reqd:1,
options: erpnext.complete_setup.fy_start_list.join('\n')},
{fieldname:'country', label: 'Country', reqd:1,
options: "", fieldtype: 'Select'},
{fieldname:'currency', label: 'Default Currency', reqd:1,
options: "", fieldtype: 'Select'},
{fieldname:'timezone', label: 'Time Zone', reqd:1,
options: "", fieldtype: 'Select'},
{fieldname:'industry', label: 'Industry', reqd:1,
options: erpnext.complete_setup.domains.join('\n'), fieldtype: 'Select'},
{fieldname:'update', label:'Setup',fieldtype:'Button'},
],
});
if(user != 'Administrator'){
d.$wrapper.find('.close').toggle(false); // Hide close image
$('header').toggle(false); // hide toolbar
}
wn.call({
method:"webnotes.country_info.get_country_timezone_info",
callback: function(data) {
erpnext.country_info = data.message.country_info;
erpnext.all_timezones = data.message.all_timezones;
d.get_input("country").empty()
.add_options([""].concat(keys(erpnext.country_info).sort()));
d.get_input("currency").empty()
.add_options(wn.utils.unique([""].concat($.map(erpnext.country_info,
function(opts, country) { return opts.currency; }))).sort());
d.get_input("timezone").empty()
.add_options([""].concat(erpnext.all_timezones));
}
})
// on clicking update
d.fields_dict.update.input.onclick = function() {
var data = d.get_values();
if(!data) return;
$(this).set_working();
return $c_obj('Setup Control','setup_account',data,function(r, rt){
$(this).done_working();
if(!r.exc) {
sys_defaults = r.message;
user_fullname = r.message.user_fullname;
wn.boot.user_info[user].fullname = user_fullname;
d.hide();
$('header').toggle(true);
wn.container.wntoolbar.set_user_name();
setTimeout(function() { window.location.reload(); }, 3000);
}
});
};
d.fields_dict.company_name.input.onchange = function() {
var parts = d.get_input("company_name").val().split(" ");
var abbr = $.map(parts, function(p) { return p ? p.substr(0,1) : null }).join("");
d.get_input("company_abbr").val(abbr.toUpperCase());
}
d.fields_dict.country.input.onchange = function() {
var country = d.fields_dict.country.input.value;
var $timezone = $(d.fields_dict.timezone.input);
$timezone.empty();
// add country specific timezones first
if(country){
var timezone_list = erpnext.country_info[country].timezones || [];
$timezone.add_options(timezone_list.sort());
d.get_input("currency").val(erpnext.country_info[country].currency);
}
// add all timezones at the end, so that user has the option to change it to any timezone
$timezone.add_options([""].concat(erpnext.all_timezones));
};
// company name already set
if(wn.control_panel.company_name) {
var inp = d.fields_dict.company_name.input;
inp.value = wn.control_panel.company_name;
inp.disabled = true;
d.fields_dict.company_name.$input.trigger("change");
}
// set first name, last name
if(user_fullname) {
u = user_fullname.split(' ');
if(u[0]) {
d.fields_dict.first_name.input.value = u[0];
}
if(u[1]) {
d.fields_dict.last_name.input.value = u[1];
}
}
return d;
},
fy_start_list: ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct'],
domains: ['', "Manufacturing", "Retail", "Distribution", "Services", "Other"],
});

View File

@ -9,27 +9,12 @@ erpnext.startup.start = function() {
console.log('Starting up...'); console.log('Starting up...');
$('#startup_div').html('Starting up...').toggle(true); $('#startup_div').html('Starting up...').toggle(true);
if(user != 'Guest'){
// setup toolbar
erpnext.toolbar.setup(); erpnext.toolbar.setup();
// complete registration if(wn.boot.expires_on && in_list(user_roles, 'System Manager')) {
if(in_list(user_roles,'System Manager') && (wn.boot.setup_complete==='No')) {
wn.require("app/js/complete_setup.js");
erpnext.complete_setup.show();
} else if(!wn.boot.customer_count) {
if(wn.get_route()[0]!=="Setup") {
msgprint("<a class='btn btn-success' href='#Setup'>"
+ wn._("Proceed to Setup") + "</a>\
<br><br><p class='text-muted'>"+
wn._("This message goes away after you create your first customer.")+
"</p>", wn._("Welcome"));
}
} else if(wn.boot.expires_on && in_list(user_roles, 'System Manager')) {
erpnext.startup.show_expiry_banner(); erpnext.startup.show_expiry_banner();
} }
} }
}
erpnext.startup.show_expiry_banner = function() { erpnext.startup.show_expiry_banner = function() {
var today = dateutil.str_to_obj(wn.boot.server_date); var today = dateutil.str_to_obj(wn.boot.server_date);

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-04-10 08:35:39", "creation": "2013-04-10 08:35:39",
"docstatus": 0, "docstatus": 0,
"modified": "2013-08-28 19:15:04", "modified": "2013-10-08 15:18:34",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -80,7 +80,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"label": "Domain", "label": "Domain",
"options": "Distribution\nManufacturing\nRetail\nServices", "options": "Distribution\nManufacturing\nRetail\nServices",
"reqd": 1 "reqd": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",

View File

@ -1 +0,0 @@
Account setup utility on first login.

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,255 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint, cstr, getdate, now, nowdate, get_defaults
from webnotes.model.doc import Document, addchild
from webnotes.model.code import get_obj
from webnotes import session, form, msgprint
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def setup_account(self, args):
import webnotes, json
if isinstance(args, basestring):
args = json.loads(args)
webnotes.conn.begin()
self.update_profile_name(args)
add_all_roles_to(webnotes.session.user)
self.create_fiscal_year_and_company(args)
self.set_defaults(args)
create_territories()
self.create_price_lists(args)
self.create_feed_and_todo()
self.create_email_digest()
webnotes.clear_cache()
msgprint("Company setup is complete. This page will be refreshed in a moment.")
webnotes.conn.commit()
return {
'sys_defaults': get_defaults(),
'user_fullname': (args.get('first_name') or '') + (args.get('last_name')
and (" " + args.get('last_name')) or '')
}
def update_profile_name(self, args):
args['name'] = webnotes.session.get('user')
# Update Profile
if not args.get('last_name') or args.get('last_name')=='None': args['last_name'] = None
webnotes.conn.sql("""\
UPDATE `tabProfile` SET first_name=%(first_name)s,
last_name=%(last_name)s
WHERE name=%(name)s AND docstatus<2""", args)
def create_fiscal_year_and_company(self, args):
curr_fiscal_year, fy_start_date, fy_abbr = self.get_fy_details(args.get('fy_start'), True)
webnotes.bean([{
"doctype":"Fiscal Year",
'year': curr_fiscal_year,
'year_start_date': fy_start_date
}]).insert()
curr_fiscal_year, fy_start_date, fy_abbr = self.get_fy_details(args.get('fy_start'))
webnotes.bean([{
"doctype":"Fiscal Year",
'year': curr_fiscal_year,
'year_start_date': fy_start_date,
}]).insert()
# Company
webnotes.bean([{
"doctype":"Company",
'domain': args.get("industry"),
'company_name':args.get('company_name'),
'abbr':args.get('company_abbr'),
'default_currency':args.get('currency'),
}]).insert()
self.curr_fiscal_year = curr_fiscal_year
def create_price_lists(self, args):
for pl_type in ["Selling", "Buying"]:
webnotes.bean([
{
"doctype": "Price List",
"price_list_name": "Standard " + pl_type,
"buying_or_selling": pl_type,
"currency": args["currency"]
},
{
"doctype": "For Territory",
"parentfield": "valid_for_territories",
"territory": "All Territories"
}
]).insert()
def set_defaults(self, args):
# enable default currency
webnotes.conn.set_value("Currency", args.get("currency"), "enabled", 1)
global_defaults = webnotes.bean("Global Defaults", "Global Defaults")
global_defaults.doc.fields.update({
'current_fiscal_year': self.curr_fiscal_year,
'default_currency': args.get('currency'),
'default_company':args.get('company_name'),
'date_format': webnotes.conn.get_value("Country", args.get("country"), "date_format"),
"float_precision": 4
})
global_defaults.save()
accounts_settings = webnotes.bean("Accounts Settings")
accounts_settings.doc.auto_accounting_for_stock = 1
accounts_settings.save()
stock_settings = webnotes.bean("Stock Settings")
stock_settings.doc.item_naming_by = "Item Code"
stock_settings.doc.valuation_method = "FIFO"
stock_settings.doc.stock_uom = "Nos"
stock_settings.doc.auto_indent = 1
stock_settings.save()
selling_settings = webnotes.bean("Selling Settings")
selling_settings.doc.cust_master_name = "Customer Name"
selling_settings.doc.so_required = "No"
selling_settings.doc.dn_required = "No"
selling_settings.save()
buying_settings = webnotes.bean("Buying Settings")
buying_settings.doc.supp_master_name = "Supplier Name"
buying_settings.doc.po_required = "No"
buying_settings.doc.pr_required = "No"
buying_settings.doc.maintain_same_rate = 1
buying_settings.save()
notification_control = webnotes.bean("Notification Control")
notification_control.doc.quotation = 1
notification_control.doc.sales_invoice = 1
notification_control.doc.purchase_order = 1
notification_control.save()
hr_settings = webnotes.bean("HR Settings")
hr_settings.doc.emp_created_by = "Naming Series"
hr_settings.save()
# control panel
cp = webnotes.doc("Control Panel", "Control Panel")
for k in ['country', 'timezone', 'company_name']:
cp.fields[k] = args[k]
cp.save()
def create_feed_and_todo(self):
"""update activty feed and create todo for creation of item, customer, vendor"""
import home
home.make_feed('Comment', 'ToDo', '', webnotes.session['user'],
'<i>"' + 'Setup Complete. Please check your <a href="#!todo">\
To Do List</a>' + '"</i>', '#6B24B3')
d = Document('ToDo')
d.description = '<a href="#Setup">Complete ERPNext Setup</a>'
d.priority = 'High'
d.date = nowdate()
d.save(1)
def create_email_digest(self):
"""
create a default weekly email digest
* Weekly Digest
* For all companies
* Recipients: System Managers
* Full content
* Enabled by default
"""
import webnotes
companies_list = webnotes.conn.sql("SELECT company_name FROM `tabCompany`", as_list=1)
from webnotes.profile import get_system_managers
system_managers = get_system_managers()
if not system_managers: return
from webnotes.model.doc import Document
for company in companies_list:
if company and company[0]:
edigest = webnotes.bean({
"doctype": "Email Digest",
"name": "Default Weekly Digest - " + company[0],
"company": company[0],
"frequency": "Weekly",
"recipient_list": "\n".join(system_managers)
})
if webnotes.conn.sql("""select name from `tabEmail Digest` where name=%s""", edigest.doc.name):
continue
for fieldname in edigest.meta.get_fieldnames({"fieldtype": "Check"}):
edigest.doc.fields[fieldname] = 1
edigest.insert()
# Get Fiscal year Details
# ------------------------
def get_fy_details(self, fy_start, last_year=False):
st = {'1st Jan':'01-01','1st Apr':'04-01','1st Jul':'07-01', '1st Oct': '10-01'}
if cint(getdate(nowdate()).month) < cint((st[fy_start].split('-'))[0]):
curr_year = getdate(nowdate()).year - 1
else:
curr_year = getdate(nowdate()).year
if last_year:
curr_year = curr_year - 1
stdt = cstr(curr_year)+'-'+cstr(st[fy_start])
if(fy_start == '1st Jan'):
fy = cstr(curr_year)
abbr = cstr(fy)[-2:]
else:
fy = cstr(curr_year) + '-' + cstr(curr_year+1)
abbr = cstr(curr_year)[-2:] + '-' + cstr(curr_year+1)[-2:]
return fy, stdt, abbr
def create_profile(self, user_email, user_fname, user_lname, pwd=None):
pr = Document('Profile')
pr.first_name = user_fname
pr.last_name = user_lname
pr.name = pr.email = user_email
pr.enabled = 1
pr.save(1)
if pwd:
webnotes.conn.sql("""insert into __Auth (user, `password`)
values (%s, password(%s))
on duplicate key update `password`=password(%s)""",
(user_email, pwd, pwd))
add_all_roles_to(pr.name)
def add_all_roles_to(name):
profile = webnotes.doc("Profile", name)
for role in webnotes.conn.sql("""select name from tabRole"""):
if role[0] not in ["Administrator", "Guest", "All", "Customer", "Supplier", "Partner"]:
d = profile.addchild("user_roles", "UserRole")
d.role = role[0]
d.insert()
def create_territories():
"""create two default territories, one for home country and one named Rest of the World"""
from setup.utils import get_root_of
country = webnotes.conn.get_value("Control Panel", None, "country")
root_territory = get_root_of("Territory")
for name in (country, "Rest Of The World"):
if name and not webnotes.conn.exists("Territory", name):
webnotes.bean({
"doctype": "Territory",
"territory_name": name.replace("'", ""),
"parent_territory": root_territory,
"is_group": "No"
}).insert()

View File

@ -1,24 +0,0 @@
[
{
"creation": "2012-03-27 14:36:25",
"docstatus": 0,
"modified": "2012-03-27 14:36:25",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "DocType",
"in_create": 1,
"issingle": 1,
"istable": 0,
"module": "Setup",
"name": "__common__",
"read_only": 1,
"section_style": "Simple",
"version": 73
},
{
"doctype": "DocType",
"name": "Setup Control"
}
]

View File

@ -1,9 +1,59 @@
wn.pages['setup-wizard'].onload = function(wrapper) { wn.pages['setup-wizard'].onload = function(wrapper) {
if(sys_defaults.company) {
wn.set_route("desktop");
return;
}
$(".navbar:first").toggle(false); $(".navbar:first").toggle(false);
$("body").css({"padding-top":"30px"});
erpnext.wiz = new wn.wiz.Wizard({ erpnext.wiz = new wn.wiz.Wizard({
page_name: "setup-wizard",
parent: wrapper, parent: wrapper,
on_complete: function(wiz) {
var values = wiz.get_values();
wiz.show_working();
console.log(values);
wn.call({
method: "setup.page.setup_wizard.setup_wizard.setup_account",
args: values,
callback: function(r) {
if(r.exc) {
var d = msgprint(wn._("There were errors."));
d.custom_onhide = function() {
wn.set_route(me.wiz.page_name, "0");
}
} else {
wiz.show_complete();
setTimeout(function() {
if(user==="Administrator") {
wn.msgprint(wn._("Login with your new User ID") + ":" + values.email);
setTimeout(function() {
wn.app.logout();
}, 2000);
} else {
window.location = "app.html";
}
}, 2000);
}
}
})
},
title: wn._("ERPNext Setup Guide"), title: wn._("ERPNext Setup Guide"),
welcome_html: '<h1 class="text-muted text-center"><i class="icon-magic"></i></h1>\
<h2 class="text-center">'+wn._('ERPNext Setup')+'</h2>\
<p class="text-center">' +
wn._('Welcome to ERPNext. Over the next few minutes we will help you setup your ERPNext account. Try and fill in as much information as you have even if it takes a bit longer. It will save you a lot of time later. Good Luck!') +
'</p>',
working_html: '<h3 class="text-muted text-center"><i class="icon-refresh icon-spin"></i></h3>\
<h2 class="text-center">'+wn._('Setting up...')+'</h2>\
<p class="text-center">' +
wn._('Sit tight while your system is being setup. This may take a few moments.') +
'</p>',
complete_html: '<h1 class="text-muted text-center"><i class="icon-thumbs-up"></i></h1>\
<h2 class="text-center">'+wn._('Setup Complete!')+'</h2>\
<p class="text-center">' +
wn._('Your setup is complete. Refreshing...') +
'</p>',
slides: [ slides: [
// User // User
{ {
@ -12,9 +62,19 @@ wn.pages['setup-wizard'].onload = function(wrapper) {
fields: [ fields: [
{"fieldname": "first_name", "label": wn._("First Name"), "fieldtype": "Data", reqd:1}, {"fieldname": "first_name", "label": wn._("First Name"), "fieldtype": "Data", reqd:1},
{"fieldname": "last_name", "label": wn._("Last Name"), "fieldtype": "Data", reqd:1}, {"fieldname": "last_name", "label": wn._("Last Name"), "fieldtype": "Data", reqd:1},
{"email_id": "email", "label": wn._("Email Id"), "fieldtype": "Data", reqd:1, "description":"Your Login Id"},
{"password": "password", "label": wn._("Password"), "fieldtype": "Password", reqd:1},
{fieldtype:"Attach Image", fieldname:"attach_profile", label:"Attach Your Profile..."}, {fieldtype:"Attach Image", fieldname:"attach_profile", label:"Attach Your Profile..."},
], ],
help: wn._('The first user will become the System Manager (you can change that later).') help: wn._('The first user will become the System Manager (you can change that later).'),
onload: function(slide) {
if(user!=="Administrator") {
slide.form.fields_dict.password.$wrapper.toggle(false);
slide.form.fields_dict.email_id.$wrapper.toggle(false);
delete slide.form.fields_dict.email;
delete slide.form.fields_dict.password;
}
}
}, },
// Organization // Organization
@ -26,6 +86,9 @@ wn.pages['setup-wizard'].onload = function(wrapper) {
placeholder: 'e.g. "My Company LLC"'}, placeholder: 'e.g. "My Company LLC"'},
{fieldname:'company_abbr', label: wn._('Company Abbreviation'), fieldtype:'Data', {fieldname:'company_abbr', label: wn._('Company Abbreviation'), fieldtype:'Data',
placeholder:'e.g. "MC"',reqd:1}, placeholder:'e.g. "MC"',reqd:1},
{fieldname:'fy_start', label:'Financial Year Start Date', fieldtype:'Select',
description:'Your financial year begins on', reqd:1,
options: ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct'] },
{fieldname:'company_tagline', label: wn._('What does it do?'), fieldtype:'Data', {fieldname:'company_tagline', label: wn._('What does it do?'), fieldtype:'Data',
placeholder:'e.g. "Build tools for builders"', reqd:1}, placeholder:'e.g. "Build tools for builders"', reqd:1},
], ],
@ -94,24 +157,6 @@ wn.pages['setup-wizard'].onload = function(wrapper) {
{fieldtype:"Attach Image", fieldname:"attach_letterhead", label:"Attach Letterhead..."}, {fieldtype:"Attach Image", fieldname:"attach_letterhead", label:"Attach Letterhead..."},
{fieldtype:"Attach Image", fieldname:"attach_logo", label:"Attach Logo..."}, {fieldtype:"Attach Image", fieldname:"attach_logo", label:"Attach Logo..."},
], ],
// html: '<h4>' + wn._('Upload Logo') + '</h4><div class="upload-area-letter-head"></div><hr>'
// +'<h4>' + wn._('Upload Letter Head') + '</h4><div class="upload-area-logo"></div>',
onload: function(slide) {
// wn.upload.make({
// parent: slide.$wrapper.find(".upload-area-letter-head").css({"margin-left": "10px"}),
// on_attach: function(fileobj) {
// console.log(fileobj);
// }
// });
//
// wn.upload.make({
// parent: slide.$wrapper.find(".upload-area-logo").css({"margin-left": "10px"}),
// on_attach: function(fileobj) {
// console.log(fileobj);
// }
// });
}
}, },
// Taxes // Taxes
@ -120,39 +165,46 @@ wn.pages['setup-wizard'].onload = function(wrapper) {
"title": wn._("Add Taxes"), "title": wn._("Add Taxes"),
"help": wn._("List your tax heads (e.g. VAT, Excise) (upto 3) and their standard rates. This will create a standard template, you can edit and add more later."), "help": wn._("List your tax heads (e.g. VAT, Excise) (upto 3) and their standard rates. This will create a standard template, you can edit and add more later."),
"fields": [ "fields": [
{fieldtype:"Column Break", fieldname:"cb_1", "label": "Tax Heads"},
{fieldtype:"Data", fieldname:"tax_1", label:"Tax 1", placeholder:"e.g. VAT"}, {fieldtype:"Data", fieldname:"tax_1", label:"Tax 1", placeholder:"e.g. VAT"},
{fieldtype:"Data", fieldname:"tax_2", label:"Tax 2", placeholder:"e.g. Customs Duty"}, {fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"tax_3", label:"Tax 3", placeholder:"e.g. Excise"},
{fieldtype:"Column Break", fieldname:"cb_2", "label": "Tax Rates"},
{fieldtype:"Data", fieldname:"tax_rate_1", label:"Rate (%)", placeholder:"e.g. 5"}, {fieldtype:"Data", fieldname:"tax_rate_1", label:"Rate (%)", placeholder:"e.g. 5"},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"tax_2", label:"Tax 2", placeholder:"e.g. Customs Duty"},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"tax_rate_2", label:"Rate (%)", placeholder:"e.g. 5"}, {fieldtype:"Data", fieldname:"tax_rate_2", label:"Rate (%)", placeholder:"e.g. 5"},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"tax_3", label:"Tax 3", placeholder:"e.g. Excise"},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"tax_rate_3", label:"Rate (%)", placeholder:"e.g. 5"}, {fieldtype:"Data", fieldname:"tax_rate_3", label:"Rate (%)", placeholder:"e.g. 5"},
], ],
onload: function(slide) {
}
}, },
// Items to Sell // Items to Sell
{ {
icon: "icon-barcode", icon: "icon-barcode",
"title": wn._("Your Products or Services"), "title": wn._("Your Products or Services"),
"help": wn._("List your products or services that you sell to your customers."), "help": wn._("List your products or services that you sell to your customers. Make sure to check the Item Group, Unit of Measure and other properties when you start."),
"fields": [ "fields": [
{fieldtype:"Data", fieldname:"item_1", label:"Item 1", placeholder:"A Product or Service"}, {fieldtype:"Data", fieldname:"item_1", label:"Item 1", placeholder:"A Product or Service"},
{fieldtype:"Data", fieldname:"item_2", label:"Item 2", placeholder:"A Product or Service"}, {fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"item_3", label:"Item 3", placeholder:"A Product or Service"},
{fieldtype:"Data", fieldname:"item_4", label:"Item 4", placeholder:"A Product or Service"},
{fieldtype:"Data", fieldname:"item_5", label:"Item 5", placeholder:"A Product or Service"},
{fieldtype:"Column Break", fieldname:"cb_2", "label": "Attachments"},
{fieldtype:"Attach", fieldname:"item_img_1", label:"Attach Image..."}, {fieldtype:"Attach", fieldname:"item_img_1", label:"Attach Image..."},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"item_2", label:"Item 2", placeholder:"A Product or Service"},
{fieldtype:"Column Break"},
{fieldtype:"Attach", fieldname:"item_img_2", label:"Attach Image..."}, {fieldtype:"Attach", fieldname:"item_img_2", label:"Attach Image..."},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"item_3", label:"Item 3", placeholder:"A Product or Service"},
{fieldtype:"Column Break"},
{fieldtype:"Attach", fieldname:"item_img_3", label:"Attach Image..."}, {fieldtype:"Attach", fieldname:"item_img_3", label:"Attach Image..."},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"item_4", label:"Item 4", placeholder:"A Product or Service"},
{fieldtype:"Column Break"},
{fieldtype:"Attach", fieldname:"item_img_4", label:"Attach Image..."}, {fieldtype:"Attach", fieldname:"item_img_4", label:"Attach Image..."},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"item_5", label:"Item 5", placeholder:"A Product or Service"},
{fieldtype:"Column Break"},
{fieldtype:"Attach", fieldname:"item_img_5", label:"Attach Image..."}, {fieldtype:"Attach", fieldname:"item_img_5", label:"Attach Image..."},
], ],
onload: function(slide) {
}
}, },
// Items to Buy // Items to Buy
@ -167,8 +219,6 @@ wn.pages['setup-wizard'].onload = function(wrapper) {
{fieldtype:"Data", fieldname:"item_buy_4", label:"Item 4", placeholder:"A Product or Service"}, {fieldtype:"Data", fieldname:"item_buy_4", label:"Item 4", placeholder:"A Product or Service"},
{fieldtype:"Data", fieldname:"item_buy_5", label:"Item 5", placeholder:"A Product or Service"}, {fieldtype:"Data", fieldname:"item_buy_5", label:"Item 5", placeholder:"A Product or Service"},
], ],
onload: function(slide) {
}
}, },
// Customers // Customers
@ -178,13 +228,25 @@ wn.pages['setup-wizard'].onload = function(wrapper) {
"help": wn._("List a few of your customers. They could be organizations or individuals."), "help": wn._("List a few of your customers. They could be organizations or individuals."),
"fields": [ "fields": [
{fieldtype:"Data", fieldname:"customer_1", label:"Customer 1", placeholder:"Customer Name"}, {fieldtype:"Data", fieldname:"customer_1", label:"Customer 1", placeholder:"Customer Name"},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"customer_contact_1", label:"", placeholder:"Contact Name"},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"customer_2", label:"Customer 2", placeholder:"Customer Name"}, {fieldtype:"Data", fieldname:"customer_2", label:"Customer 2", placeholder:"Customer Name"},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"customer_contact_2", label:"", placeholder:"Contact Name"},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"customer_3", label:"Customer 3", placeholder:"Customer Name"}, {fieldtype:"Data", fieldname:"customer_3", label:"Customer 3", placeholder:"Customer Name"},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"customer_contact_3", label:"", placeholder:"Contact Name"},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"customer_4", label:"Customer 4", placeholder:"Customer Name"}, {fieldtype:"Data", fieldname:"customer_4", label:"Customer 4", placeholder:"Customer Name"},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"customer_contact_4", label:"", placeholder:"Contact Name"},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"customer_5", label:"Customer 5", placeholder:"Customer Name"}, {fieldtype:"Data", fieldname:"customer_5", label:"Customer 5", placeholder:"Customer Name"},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"customer_contact_5", label:"", placeholder:"Contact Name"},
], ],
onload: function(slide) {
}
}, },
// Suppliers // Suppliers
@ -194,13 +256,25 @@ wn.pages['setup-wizard'].onload = function(wrapper) {
"help": wn._("List a few of your suppliers. They could be organizations or individuals."), "help": wn._("List a few of your suppliers. They could be organizations or individuals."),
"fields": [ "fields": [
{fieldtype:"Data", fieldname:"supplier_1", label:"Supplier 1", placeholder:"Supplier Name"}, {fieldtype:"Data", fieldname:"supplier_1", label:"Supplier 1", placeholder:"Supplier Name"},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"supplier_contact_1", label:"", placeholder:"Contact Name"},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"supplier_2", label:"Supplier 2", placeholder:"Supplier Name"}, {fieldtype:"Data", fieldname:"supplier_2", label:"Supplier 2", placeholder:"Supplier Name"},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"supplier_contact_2", label:"", placeholder:"Contact Name"},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"supplier_3", label:"Supplier 3", placeholder:"Supplier Name"}, {fieldtype:"Data", fieldname:"supplier_3", label:"Supplier 3", placeholder:"Supplier Name"},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"supplier_contact_3", label:"", placeholder:"Contact Name"},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"supplier_4", label:"Supplier 4", placeholder:"Supplier Name"}, {fieldtype:"Data", fieldname:"supplier_4", label:"Supplier 4", placeholder:"Supplier Name"},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"supplier_contact_4", label:"", placeholder:"Contact Name"},
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"supplier_5", label:"Supplier 5", placeholder:"Supplier Name"}, {fieldtype:"Data", fieldname:"supplier_5", label:"Supplier 5", placeholder:"Supplier Name"},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"supplier_contact_5", label:"", placeholder:"Contact Name"},
], ],
onload: function(slide) {
}
} }
] ]
@ -209,7 +283,8 @@ wn.pages['setup-wizard'].onload = function(wrapper) {
} }
wn.pages['setup-wizard'].onshow = function(wrapper) { wn.pages['setup-wizard'].onshow = function(wrapper) {
erpnext.wiz.show(wn.get_route()[1] || "0"); if(wn.get_route()[1])
erpnext.wiz.show(wn.get_route()[1]);
} }
wn.provide("wn.wiz"); wn.provide("wn.wiz");
@ -217,10 +292,45 @@ wn.provide("wn.wiz");
wn.wiz.Wizard = Class.extend({ wn.wiz.Wizard = Class.extend({
init: function(opts) { init: function(opts) {
$.extend(this, opts); $.extend(this, opts);
this.slides = this.slides;
this.slide_dict = {}; this.slide_dict = {};
wn.set_route("setup-wizard", "0"); this.show_welcome();
},
get_message: function(html) {
return $(repl('<div class="panel panel-default" style="max-width: 400px; margin: auto;">\
<div class="panel-body" style="padding: 40px;">%(html)s</div>\
</div>', {html:html}))
},
show_welcome: function() {
if(this.$welcome)
return;
var me = this;
this.$welcome = this.get_message(this.welcome_html +
'<br><p class="text-center"><button class="btn btn-primary">'+wn._("Start")+'</button></p>')
.appendTo(this.parent);
this.$welcome.find(".btn").click(function() {
me.$welcome.toggle(false);
me.welcomed = true;
wn.set_route(me.page_name, "0");
})
this.current_slide = {"$wrapper": this.$welcome};
},
show_working: function() {
this.hide_current_slide();
wn.set_route(this.page_name);
this.current_slide = {"$wrapper": this.get_message(this.working_html).appendTo(this.parent)};
},
show_complete: function() {
this.hide_current_slide();
this.current_slide = {"$wrapper": this.get_message(this.complete_html).appendTo(this.parent)};
}, },
show: function(id) { show: function(id) {
if(!this.welcomed) {
wn.set_route(this.wiz.page_name);
return;
}
id = cint(id); id = cint(id);
if(this.current_slide && this.current_slide.id===id) if(this.current_slide && this.current_slide.id===id)
return; return;
@ -229,12 +339,24 @@ wn.wiz.Wizard = Class.extend({
this.slide_dict[id].make(); this.slide_dict[id].make();
} }
if(this.current_slide) this.hide_current_slide();
this.current_slide.$wrapper.toggle(false);
this.current_slide = this.slide_dict[id]; this.current_slide = this.slide_dict[id];
this.current_slide.$wrapper.toggle(true); this.current_slide.$wrapper.toggle(true);
}, },
hide_current_slide: function() {
if(this.current_slide) {
this.current_slide.$wrapper.toggle(false);
this.current_slide = null;
}
},
get_values: function() {
var values = {};
$.each(this.slide_dict, function(id, slide) {
$.extend(values, slide.values)
})
return values;
}
}); });
wn.wiz.WizardSlide = Class.extend({ wn.wiz.WizardSlide = Class.extend({
@ -249,10 +371,12 @@ wn.wiz.WizardSlide = Class.extend({
<div class="progress">\ <div class="progress">\
<div class="progress-bar" style="width: %(width)s%"></div>\ <div class="progress-bar" style="width: %(width)s%"></div>\
</div>\ </div>\
<h3><i class="%(icon)s text-muted"></i> %(title)s</h3><br>\
<div class="row">\ <div class="row">\
<div class="col-sm-6 form"></div>\ <div class="col-sm-6 form"></div>\
<div class="col-sm-6 help"><p class="text-muted">%(help)s</p></div>\ <div class="col-sm-6 help">\
<h3><i class="%(icon)s text-muted"></i> %(title)s</h3><br>\
<p class="text-muted">%(help)s</p>\
</div>\
</div>\ </div>\
<hr>\ <hr>\
<div class="footer"></div>\ <div class="footer"></div>\
@ -276,17 +400,29 @@ wn.wiz.WizardSlide = Class.extend({
if(this.id > 0) { if(this.id > 0) {
this.$prev = $("<button class='btn btn-default'>Previous</button>") this.$prev = $("<button class='btn btn-default'>Previous</button>")
.click(function() { wn.set_route("setup-wizard", me.id-1 + ""); }) .click(function() {
wn.set_route(me.wiz.page_name, me.id-1 + "");
})
.appendTo(this.$wrapper.find(".footer")) .appendTo(this.$wrapper.find(".footer"))
.css({"margin-right": "5px"}); .css({"margin-right": "5px"});
} }
if(this.id+1 < this.wiz.slides.length) { if(this.id+1 < this.wiz.slides.length) {
this.$next = $("<button class='btn btn-primary'>Next</button>") this.$next = $("<button class='btn btn-primary'>Next</button>")
.click(function() { wn.set_route("setup-wizard", me.id+1 + ""); }) .click(function() {
me.values = me.form.get_values();
if(me.values===null)
return;
wn.set_route(me.wiz.page_name, me.id+1 + "");
})
.appendTo(this.$wrapper.find(".footer")); .appendTo(this.$wrapper.find(".footer"));
} else { } else {
this.$complete = $("<button class='btn btn-primary'>Complete Setup</button>") this.$complete = $("<button class='btn btn-primary'>Complete Setup</button>")
.click(function() { me.wiz.complete(); }).appendTo(this.$wrapper.find(".footer")); .click(function() {
me.values = me.form.get_values();
if(me.values===null)
return;
me.wiz.on_complete(me.wiz);
}).appendTo(this.$wrapper.find(".footer"));
} }
if(this.onload) { if(this.onload) {

View File

@ -0,0 +1,349 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes, json, base64
from webnotes.utils import cint, cstr, getdate, now, nowdate, get_defaults
from webnotes import _
from webnotes.utils.file_manager import save_file
@webnotes.whitelist()
def setup_account(args=None):
# if webnotes.conn.sql("select name from tabCompany"):
# webnotes.throw(_("Setup Already Complete!!"))
if not args:
args = webnotes.local.form_dict
if isinstance(args, basestring):
args = json.loads(args)
webnotes.conn.begin()
update_profile_name(args)
create_fiscal_year_and_company(args)
set_defaults(args)
create_territories()
create_price_lists(args)
create_feed_and_todo()
create_email_digest()
create_taxes(args)
create_items(args)
create_customers(args)
create_suppliers(args)
webnotes.conn.set_value('Control Panel', None, 'home_page', 'desktop')
webnotes.clear_cache()
webnotes.conn.commit()
return "okay"
def update_profile_name(args):
if args.get("email_id"):
args['name'] = args.get("email")
webnotes.mute_emails = True
webnotes.bean({
"doctype":"Profile",
"email": args.get("email"),
"first_name": args.get("first_name"),
"last_name": args.get("last_name")
}).insert()
webnotes.mute_emails = False
from webnotes.auth import _update_password
_update_password(args.get("email"), args.get("password"))
else:
args['name'] = webnotes.session.user
# Update Profile
if not args.get('last_name') or args.get('last_name')=='None':
args['last_name'] = None
webnotes.conn.sql("""update `tabProfile` SET first_name=%(first_name)s,
last_name=%(last_name)s WHERE name=%(name)s""", args)
if args.get("attach_profile"):
filename, filetype, content = args.get("attach_profile").split(",")
fileurl = save_file(filename, content, "Profile", args.get("name"), decode=True).file_name
webnotes.conn.set_value("Profile", args.get("name"), "user_image", fileurl)
add_all_roles_to(args.get("name"))
def create_fiscal_year_and_company(args):
curr_fiscal_year, fy_start_date, fy_abbr = get_fy_details(args.get('fy_start'), True)
webnotes.bean([{
"doctype":"Fiscal Year",
'year': curr_fiscal_year,
'year_start_date': fy_start_date
}]).insert()
curr_fiscal_year, fy_start_date, fy_abbr = get_fy_details(args.get('fy_start'))
webnotes.bean([{
"doctype":"Fiscal Year",
'year': curr_fiscal_year,
'year_start_date': fy_start_date,
}]).insert()
# Company
webnotes.bean([{
"doctype":"Company",
'domain': args.get("industry"),
'company_name':args.get('company_name'),
'abbr':args.get('company_abbr'),
'default_currency':args.get('currency'),
}]).insert()
args["curr_fiscal_year"] = curr_fiscal_year
def create_price_lists(args):
for pl_type in ["Selling", "Buying"]:
webnotes.bean([
{
"doctype": "Price List",
"price_list_name": "Standard " + pl_type,
"buying_or_selling": pl_type,
"currency": args["currency"]
},
{
"doctype": "For Territory",
"parentfield": "valid_for_territories",
"territory": "All Territories"
}
]).insert()
def set_defaults(args):
# enable default currency
webnotes.conn.set_value("Currency", args.get("currency"), "enabled", 1)
global_defaults = webnotes.bean("Global Defaults", "Global Defaults")
global_defaults.doc.fields.update({
'current_fiscal_year': args.curr_fiscal_year,
'default_currency': args.get('currency'),
'default_company':args.get('company_name'),
'date_format': webnotes.conn.get_value("Country", args.get("country"), "date_format"),
"float_precision": 4
})
global_defaults.save()
accounts_settings = webnotes.bean("Accounts Settings")
accounts_settings.doc.auto_accounting_for_stock = 1
accounts_settings.save()
stock_settings = webnotes.bean("Stock Settings")
stock_settings.doc.item_naming_by = "Item Code"
stock_settings.doc.valuation_method = "FIFO"
stock_settings.doc.stock_uom = "Nos"
stock_settings.doc.auto_indent = 1
stock_settings.save()
selling_settings = webnotes.bean("Selling Settings")
selling_settings.doc.cust_master_name = "Customer Name"
selling_settings.doc.so_required = "No"
selling_settings.doc.dn_required = "No"
selling_settings.save()
buying_settings = webnotes.bean("Buying Settings")
buying_settings.doc.supp_master_name = "Supplier Name"
buying_settings.doc.po_required = "No"
buying_settings.doc.pr_required = "No"
buying_settings.doc.maintain_same_rate = 1
buying_settings.save()
notification_control = webnotes.bean("Notification Control")
notification_control.doc.quotation = 1
notification_control.doc.sales_invoice = 1
notification_control.doc.purchase_order = 1
notification_control.save()
hr_settings = webnotes.bean("HR Settings")
hr_settings.doc.emp_created_by = "Naming Series"
hr_settings.save()
# control panel
cp = webnotes.doc("Control Panel", "Control Panel")
for k in ['country', 'timezone', 'company_name']:
cp.fields[k] = args[k]
cp.save()
def create_feed_and_todo():
"""update activty feed and create todo for creation of item, customer, vendor"""
import home
home.make_feed('Comment', 'ToDo', '', webnotes.session['user'],
'ERNext Setup Complete!', '#6B24B3')
def create_email_digest():
from webnotes.profile import get_system_managers
system_managers = get_system_managers()
if not system_managers:
return
for company in webnotes.conn.sql_list("select name FROM `tabCompany`"):
if not webnotes.conn.exists("Email Digest", "Default Weekly Digest - " + company):
edigest = webnotes.bean({
"doctype": "Email Digest",
"name": "Default Weekly Digest - " + company,
"company": company,
"frequency": "Weekly",
"recipient_list": "\n".join(system_managers)
})
for fieldname in edigest.meta.get_fieldnames({"fieldtype": "Check"}):
edigest.doc.fields[fieldname] = 1
edigest.insert()
def get_fy_details(fy_start, last_year=False):
st = {'1st Jan':'01-01','1st Apr':'04-01','1st Jul':'07-01', '1st Oct': '10-01'}
if cint(getdate(nowdate()).month) < cint((st[fy_start].split('-'))[0]):
curr_year = getdate(nowdate()).year - 1
else:
curr_year = getdate(nowdate()).year
if last_year:
curr_year = curr_year - 1
stdt = cstr(curr_year)+'-'+cstr(st[fy_start])
if(fy_start == '1st Jan'):
fy = cstr(curr_year)
abbr = cstr(fy)[-2:]
else:
fy = cstr(curr_year) + '-' + cstr(curr_year+1)
abbr = cstr(curr_year)[-2:] + '-' + cstr(curr_year+1)[-2:]
return fy, stdt, abbr
def create_taxes(args):
for i in xrange(1,6):
if args.get("tax_" + str(i)):
webnotes.bean({
"doctype":"Account",
"company": args.get("company_name"),
"parent_account": "Duties and Taxes - " + args.get("company_abbr"),
"account_name": args.get("tax_" + str(i)),
"group_or_ledger": "Ledger",
"is_pl_account": "No",
"account_type": "Tax",
"tax_rate": args.get("tax_rate_" + str(i))
}).insert()
def create_items(args):
for i in xrange(1,6):
item = args.get("item_" + str(i))
if item:
webnotes.bean({
"doctype":"Item",
"item_code": item,
"item_name": item,
"description": item,
"is_sales_item": "Yes",
"is_stock_item": "Yes",
"item_group":"Products",
"stock_uom": "Unit",
"default_warehouse": "Finished Goods - " + args.get("company_abbr")
}).insert()
if args.get("item_img_" + str(i)):
filename, filetype, content = args.get("item_img_" + str(i)).split(",")
fileurl = save_file(filename, content, "Item", item, decode=True).file_name
webnotes.conn.set_value("Item", item, "image", fileurl)
for i in xrange(1,6):
item = args.get("item_buy_" + str(i))
if item:
webnotes.bean({
"doctype":"Item",
"item_code": item,
"item_name": item,
"description": item,
"is_sales_item": "No",
"is_stock_item": "Yes",
"item_group":"Raw Material",
"stock_uom": "Unit",
"default_warehouse": "Stores - " + args.get("company_abbr")
}).insert()
if args.get("item_img_" + str(i)):
filename, filetype, content = args.get("item_img_" + str(i)).split(",")
fileurl = save_file(filename, content, "Item", item, decode=True).file_name
webnotes.conn.set_value("Item", item, "image", fileurl)
def create_customers(args):
for i in xrange(1,6):
customer = args.get("customer_" + str(i))
if customer:
webnotes.bean({
"doctype":"Customer",
"customer_name": customer,
"customer_type": "Company",
"customer_group": "Commercial",
"territory": args.get("country"),
"company": args.get("company_name")
}).insert()
if args.get("customer_contact_" + str(i)):
contact = args.get("customer_contact_" + str(i)).split(" ")
webnotes.bean({
"doctype":"Contact",
"customer": customer,
"first_name":contact[0],
"last_name": len(contact) > 1 and contact[1] or ""
}).insert()
def create_suppliers(args):
for i in xrange(1,6):
supplier = args.get("supplier_" + str(i))
if supplier:
webnotes.bean({
"doctype":"Supplier",
"supplier_name": supplier,
"supplier_type": "Local",
"company": args.get("company_name")
}).insert()
if args.get("supplier_contact_" + str(i)):
contact = args.get("supplier_contact_" + str(i)).split(" ")
webnotes.bean({
"doctype":"Contact",
"supplier": supplier,
"first_name":contact[0],
"last_name": len(contact) > 1 and contact[1] or ""
}).insert()
def create_profile(user_email, user_fname, user_lname, pwd=None):
pr = webnotes.doc('Profile')
pr.first_name = user_fname
pr.last_name = user_lname
pr.name = pr.email = user_email
pr.enabled = 1
pr.save(1)
if pwd:
webnotes.conn.sql("""insert into __Auth (user, `password`)
values (%s, password(%s))
on duplicate key update `password`=password(%s)""",
(user_email, pwd, pwd))
add_all_roles_to(pr.name)
def add_all_roles_to(name):
profile = webnotes.doc("Profile", name)
for role in webnotes.conn.sql("""select name from tabRole"""):
if role[0] not in ["Administrator", "Guest", "All", "Customer", "Supplier", "Partner"]:
d = profile.addchild("user_roles", "UserRole")
d.role = role[0]
d.insert()
def create_territories():
"""create two default territories, one for home country and one named Rest of the World"""
from setup.utils import get_root_of
country = webnotes.conn.get_value("Control Panel", None, "country")
root_territory = get_root_of("Territory")
for name in (country, "Rest Of The World"):
if name and not webnotes.conn.exists("Territory", name):
webnotes.bean({
"doctype": "Territory",
"territory_name": name.replace("'", ""),
"parent_territory": root_territory,
"is_group": "No"
}).insert()

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,14 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from setup.page.setup_wizard.test_setup_data import args
from setup.page.setup_wizard.setup_wizard import setup_account
if __name__=="__main__":
webnotes.connect()
webnotes.local.form_dict = webnotes._dict(args)
setup_account()

View File

@ -13,13 +13,13 @@ def post_import():
import_country_and_currency() import_country_and_currency()
# home page # home page
webnotes.conn.set_value('Control Panel', None, 'home_page', 'desktop') webnotes.conn.set_value('Control Panel', None, 'home_page', 'setup-wizard')
# features # features
feature_setup() feature_setup()
# all roles to Administrator # all roles to Administrator
from setup.doctype.setup_control.setup_control import add_all_roles_to from setup.page.setup_wizard.setup_wizard import add_all_roles_to
add_all_roles_to("Administrator") add_all_roles_to("Administrator")
webnotes.conn.commit() webnotes.conn.commit()

View File

@ -376,7 +376,8 @@ def install():
def complete_setup(): def complete_setup():
print "Complete Setup..." print "Complete Setup..."
webnotes.get_obj("Setup Control").setup_account({ from setup.page.setup_wizard.setup_wizard import setup_account
setup_account({
"first_name": "Test", "first_name": "Test",
"last_name": "User", "last_name": "User",
"fy_start": "1st Jan", "fy_start": "1st Jan",

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-01-10 16:34:32", "creation": "2013-01-10 16:34:32",
"docstatus": 0, "docstatus": 0,
"modified": "2013-10-03 16:44:08", "modified": "2013-10-08 16:48:50",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -85,7 +85,7 @@
"label": "Email Id", "label": "Email Id",
"oldfieldname": "email_id", "oldfieldname": "email_id",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"reqd": 1, "reqd": 0,
"search_index": 1 "search_index": 1
}, },
{ {
@ -95,7 +95,7 @@
"label": "Phone", "label": "Phone",
"oldfieldname": "contact_no", "oldfieldname": "contact_no",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"reqd": 1 "reqd": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",