Merge pull request #1638 from anandpdoshi/hotfix
Improved Item maker in Setup Wizard. Fixes #1501 and #1601
This commit is contained in:
commit
b1f212d653
@ -1,6 +1,5 @@
|
||||
execute:import unidecode # new requirement
|
||||
|
||||
execute:frappe.db.sql("""update `tabPatch Log` set patch=replace(patch, '.4_0.', '.v4_0.')""") #2014-05-12
|
||||
erpnext.patches.v4_0.validate_v3_patch
|
||||
erpnext.patches.v4_0.update_user_properties
|
||||
erpnext.patches.v4_0.move_warehouse_user_to_restrictions
|
||||
|
@ -7,8 +7,14 @@
|
||||
}
|
||||
.setup-wizard-wrapper {
|
||||
margin: 0px auto;
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.setup-wizard-wrapper {
|
||||
width: 720px;
|
||||
}
|
||||
}
|
||||
|
||||
#page-setup-wizard .panel {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ frappe.pages['setup-wizard'].onload = function(wrapper) {
|
||||
wiz.show_complete();
|
||||
setTimeout(function() {
|
||||
if(user==="Administrator") {
|
||||
msgprint(__("Login with your new User ID") + ":" + values.email);
|
||||
msgprint(__("Login with your new User ID") + ": " + values.email);
|
||||
setTimeout(function() {
|
||||
frappe.app.logout();
|
||||
}, 2000);
|
||||
@ -62,7 +62,7 @@ frappe.pages['setup-wizard'].onload = function(wrapper) {
|
||||
{"fieldname": "language", "label": __("Language"), "fieldtype": "Select",
|
||||
options: ["english", "العربية", "deutsch", "ελληνικά", "español", "français", "हिंदी", "hrvatski",
|
||||
"italiano", "nederlands", "português brasileiro", "português", "српски", "தமிழ்",
|
||||
"ไทย", "中国(简体", "中國(繁體"], reqd:1},
|
||||
"ไทย", "中国(简体)", "中國(繁體)"], reqd:1},
|
||||
],
|
||||
help: __("Welcome to ERPNext. Please select your language to begin the Setup Wizard."),
|
||||
onload: function(slide) {
|
||||
@ -237,12 +237,13 @@ frappe.pages['setup-wizard'].onload = function(wrapper) {
|
||||
{
|
||||
icon: "icon-money",
|
||||
"title": __("Add Taxes"),
|
||||
"help": __("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": __("List your tax heads (e.g. VAT, Excise; they should have unique names) and their standard rates. This will create a standard template, which you can edit and add more later."),
|
||||
"fields": [],
|
||||
before_load: function(slide) {
|
||||
for(var i=1; i<4; i++) {
|
||||
slide.fields = slide.fields.concat([
|
||||
{fieldtype:"Data", fieldname:"tax_"+ i, label:__("Tax") + " " + i, placeholder:__("e.g. VAT")},
|
||||
{fieldtype:"Data", fieldname:"tax_"+ i, label:__("Tax") + " " + i,
|
||||
placeholder:__("e.g. VAT") + " " + i},
|
||||
{fieldtype:"Column Break"},
|
||||
{fieldtype:"Float", fieldname:"tax_rate_" + i, label:__("Rate (%)"), placeholder:__("e.g. 5")},
|
||||
{fieldtype:"Section Break"},
|
||||
@ -264,33 +265,7 @@ frappe.pages['setup-wizard'].onload = function(wrapper) {
|
||||
placeholder:__("Customer Name")},
|
||||
{fieldtype:"Column Break"},
|
||||
{fieldtype:"Data", fieldname:"customer_contact_" + i,
|
||||
label:__("Contact"), placeholder:__("Contact Name")},
|
||||
{fieldtype:"Section Break"}
|
||||
])
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Items to Sell
|
||||
{
|
||||
icon: "icon-barcode",
|
||||
"title": __("Your Products or Services"),
|
||||
"help": __("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": [],
|
||||
before_load: function(slide) {
|
||||
for(var i=1; i<6; i++) {
|
||||
slide.fields = slide.fields.concat([
|
||||
{fieldtype:"Data", fieldname:"item_" + i, label:__("Item") + " " + i,
|
||||
placeholder:__("A Product or Service")},
|
||||
{fieldtype:"Column Break"},
|
||||
{fieldtype:"Attach", fieldname:"item_img_" + i, label:__("Attach Image")},
|
||||
{fieldtype:"Section Break"},
|
||||
{fieldtype:"Column Break"},
|
||||
{fieldtype:"Select", label:"Group", fieldname:"item_group_" + i,
|
||||
options:[__("Products"), __("Services")]},
|
||||
{fieldtype:"Column Break"},
|
||||
{fieldtype:"Select", fieldname:"item_uom_" + i, label:"UOM",
|
||||
options:[__("Unit"), __("Nos"), __("Box"), __("Pair"), __("Kg"), __("Set"), __("Hour"), __("Minute")]},
|
||||
label:__("Contact Name") + " " + i, placeholder:__("Contact Name")},
|
||||
{fieldtype:"Section Break"}
|
||||
])
|
||||
}
|
||||
@ -307,41 +282,42 @@ frappe.pages['setup-wizard'].onload = function(wrapper) {
|
||||
for(var i=1; i<6; i++) {
|
||||
slide.fields = slide.fields.concat([
|
||||
{fieldtype:"Data", fieldname:"supplier_" + i, label:__("Supplier")+" " + i,
|
||||
placeholder:"Supplier Name"},
|
||||
placeholder:__("Supplier Name")},
|
||||
{fieldtype:"Column Break"},
|
||||
{fieldtype:"Data", fieldname:"supplier_contact_" + i,
|
||||
label:"Contact", placeholder:__("Contact Name")},
|
||||
label:__("Contact Name") + " " + i, placeholder:__("Contact Name")},
|
||||
{fieldtype:"Section Break"}
|
||||
])
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Items to Buy
|
||||
// Items to Sell
|
||||
{
|
||||
icon: "icon-barcode",
|
||||
"title": __("Products or Services You Buy"),
|
||||
"help": __("List a few products or services you buy from your suppliers or vendors. If these are same as your products, then do not add them."),
|
||||
"title": __("Your Products or Services"),
|
||||
"help": __("List your products or services that you buy or sell. Make sure to check the Item Group, Unit of Measure and other properties when you start."),
|
||||
"fields": [],
|
||||
before_load: function(slide) {
|
||||
for(var i=1; i<6; i++) {
|
||||
slide.fields = slide.fields.concat([
|
||||
{fieldtype:"Data", fieldname:"item_buy_" + i, label: __("Item") + " " + i,
|
||||
{fieldtype:"Section Break", show_section_border: true},
|
||||
{fieldtype:"Data", fieldname:"item_" + i, label:__("Item") + " " + i,
|
||||
placeholder:__("A Product or Service")},
|
||||
{fieldtype: "Check", fieldname: "is_sales_item_" + i, label:__("We sell this Item")},
|
||||
{fieldtype: "Check", fieldname: "is_purchase_item_" + i, label:__("We buy this Item")},
|
||||
{fieldtype:"Column Break"},
|
||||
{fieldtype:"Section Break"},
|
||||
{fieldtype:"Column Break"},
|
||||
{fieldtype:"Select", fieldname:"item_buy_group_" + i, label: __("Group"),
|
||||
options:[__("Raw Material"), __("Consumable"), __("Sub Assemblies"), __("Services"), __("Products")]},
|
||||
{fieldtype:"Column Break"},
|
||||
{fieldtype:"Select", fieldname:"item_buy_uom_" + i, label: __("UOM"),
|
||||
options:[__("Unit"), __("Nos"), __("Box"), __("Pair"), __("Kg"), __("Set"), __("Hour"), __("Minute")]},
|
||||
{fieldtype:"Section Break"},
|
||||
{fieldtype:"Select", label:"Group", fieldname:"item_group_" + i,
|
||||
options:[__("Products"), __("Services"),
|
||||
__("Raw Material"), __("Consumable"), __("Sub Assemblies")]},
|
||||
{fieldtype:"Select", fieldname:"item_uom_" + i, label:"UOM",
|
||||
options:[__("Unit"), __("Nos"), __("Box"), __("Pair"), __("Kg"), __("Set"),
|
||||
__("Hour"), __("Minute")]},
|
||||
{fieldtype:"Attach", fieldname:"item_img_" + i, label:__("Attach Image")},
|
||||
])
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
@ -461,7 +437,7 @@ frappe.wiz.WizardSlide = Class.extend({
|
||||
</div>\
|
||||
<div class="row">\
|
||||
<div class="col-sm-12">\
|
||||
<p class="text-muted">%(help)s</p><br>\
|
||||
<p>%(help)s</p><br>\
|
||||
<div class="form"></div>\
|
||||
</div>\
|
||||
</div>\
|
||||
@ -503,6 +479,8 @@ frappe.wiz.WizardSlide = Class.extend({
|
||||
me.values = me.form.get_values();
|
||||
if(me.values===null)
|
||||
return;
|
||||
if(me.validate && !me.validate())
|
||||
return;
|
||||
frappe.set_route(me.wiz.page_name, me.id+1 + "");
|
||||
})
|
||||
} else {
|
||||
@ -511,6 +489,8 @@ frappe.wiz.WizardSlide = Class.extend({
|
||||
me.values = me.form.get_values();
|
||||
if(me.values===null)
|
||||
return;
|
||||
if(me.validate && !me.validate())
|
||||
return;
|
||||
me.wiz.on_complete(me.wiz);
|
||||
})
|
||||
}
|
||||
|
@ -291,17 +291,28 @@ def create_items(args):
|
||||
item = args.get("item_" + str(i))
|
||||
if item:
|
||||
item_group = args.get("item_group_" + str(i))
|
||||
is_sales_item = args.get("is_sales_item_" + str(i))
|
||||
is_purchase_item = args.get("is_purchase_item_" + str(i))
|
||||
is_stock_item = item_group!=_("Services")
|
||||
default_warehouse = ""
|
||||
if is_stock_item:
|
||||
if is_sales_item:
|
||||
default_warehouse = _("Finished Goods") + " - " + args.get("company_abbr")
|
||||
else:
|
||||
default_warehouse = _("Stores") + " - " + args.get("company_abbr")
|
||||
|
||||
frappe.get_doc({
|
||||
"doctype":"Item",
|
||||
"item_code": item,
|
||||
"item_name": item,
|
||||
"description": item,
|
||||
"is_sales_item": "Yes",
|
||||
"is_sales_item": "Yes" if is_sales_item else "No",
|
||||
"is_purchase_item": "Yes" if is_purchase_item else "No",
|
||||
"show_in_website": 1,
|
||||
"is_stock_item": item_group!=_("Services") and "Yes" or "No",
|
||||
"is_stock_item": is_stock_item and "Yes" or "No",
|
||||
"item_group": item_group,
|
||||
"stock_uom": args.get("item_uom_" + str(i)),
|
||||
"default_warehouse": item_group!=_("Service") and (_("Finished Goods") + " - " + args.get("company_abbr")) or ""
|
||||
"default_warehouse": default_warehouse
|
||||
}).insert()
|
||||
|
||||
if args.get("item_img_" + str(i)):
|
||||
@ -309,28 +320,6 @@ def create_items(args):
|
||||
fileurl = save_file(filename, content, "Item", item, decode=True).file_url
|
||||
frappe.db.set_value("Item", item, "image", fileurl)
|
||||
|
||||
for i in xrange(1,6):
|
||||
item = args.get("item_buy_" + str(i))
|
||||
if item:
|
||||
item_group = args.get("item_buy_group_" + str(i))
|
||||
frappe.get_doc({
|
||||
"doctype":"Item",
|
||||
"item_code": item,
|
||||
"item_name": item,
|
||||
"description": item,
|
||||
"is_sales_item": "No",
|
||||
"is_stock_item": item_group!=_("Services") and "Yes" or "No",
|
||||
"item_group": item_group,
|
||||
"stock_uom": args.get("item_buy_uom_" + str(i)),
|
||||
"default_warehouse": item_group!=_("Services") and (_("Stores") + " - " + args.get("company_abbr")) or ""
|
||||
}).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_url
|
||||
frappe.db.set_value("Item", item, "image", fileurl)
|
||||
|
||||
|
||||
def create_customers(args):
|
||||
for i in xrange(1,6):
|
||||
customer = args.get("customer_" + str(i))
|
||||
|
Loading…
x
Reference in New Issue
Block a user