User Progress (#10336)
* [user-progress] first cut
* [user-progress] Add users slide, remove taxes, make sample data
* wip tests
* [setup-wiz] UI test
* [user-progress] notif test, docs trim
* wip
* [user-progress] Setup Progress single to update action states, fixtures
* setup progress actions patch
* rename sales_target field patch
* [progress] wip reform slide data
* [progress] remove slide data
* [setup] add roles for GST doctypes, remove commit from fixtures
diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js
index d551885..320d871 100644
--- a/erpnext/public/js/setup_wizard.js
+++ b/erpnext/public/js/setup_wizard.js
@@ -7,7 +7,11 @@
}
};
-var erpnext_slides = [
+frappe.setup.on("before_load", function () {
+ erpnext.setup.slides_settings.map(frappe.setup.add_slide);
+});
+
+erpnext.setup.slides_settings = [
{
// Domain
name: 'domain',
@@ -18,14 +22,14 @@
fieldname: 'domain', label: __('Domain'), fieldtype: 'Select',
options: [
{ "label": __("Distribution"), "value": "Distribution" },
- { "label": __("Education"), "value": "Education" },
{ "label": __("Manufacturing"), "value": "Manufacturing" },
{ "label": __("Retail"), "value": "Retail" },
- { "label": __("Services"), "value": "Services" }
+ { "label": __("Services"), "value": "Services" },
+ { "label": __("Education"), "value": "Education" }
], reqd: 1
},
],
- help: __('Select the nature of your business.'),
+ // help: __('Select the nature of your business.'),
onload: function (slide) {
slide.get_input("domain").on("change", function () {
frappe.setup.domain = $(this).val();
@@ -40,7 +44,7 @@
domains: ["all"],
icon: "fa fa-bookmark",
title: __("The Brand"),
- help: __('Upload your letter head and logo. (you can edit them later).'),
+ // help: __('Upload your letter head and logo. (you can edit them later).'),
fields: [
{
fieldtype: "Attach Image", fieldname: "attach_logo",
@@ -79,6 +83,12 @@
slide.get_field("company_abbr").set_value("");
}
});
+ },
+ validate: function() {
+ if (!this.values.company_abbr) {
+ return false;
+ }
+ return true;
}
},
{
@@ -87,9 +97,9 @@
domains: ["all"],
title: __("Your Organization"),
icon: "fa fa-building",
- help: (frappe.setup.domain === 'Education' ?
- __('The name of the institute for which you are setting up this system.') :
- __('The name of your company for which you are setting up this system.')),
+ // help: (frappe.setup.domain === 'Education' ?
+ // __('The name of the institute for which you are setting up this system.') :
+ // __('The name of your company for which you are setting up this system.')),
fields: [
{
fieldname: 'company_tagline',
@@ -189,213 +199,6 @@
slide.form.fields_dict.fy_end_date.set_value(year_end_date);
});
}
- },
-
- {
- // Users
- name: 'users',
- domains: ["all"],
- title: __("Add Users"),
- help: __("Add users to your organization, other than yourself"),
- add_more: 1,
- max_count: 3,
- fields: [
- {fieldtype:"Section Break"},
- {fieldtype:"Data", fieldname:"user_fullname",
- label:__("Full Name"), static: 1},
- {fieldtype:"Data", fieldname:"user_email", label:__("Email ID"),
- placeholder:__("user@example.com"), options: "Email", static: 1},
- {fieldtype:"Column Break"},
- {fieldtype: "Check", fieldname: "user_sales",
- label:__("Sales"), "default": 1, static: 1,
- hidden: frappe.setup.domain==='Education' ? 1 : 0},
- {fieldtype: "Check", fieldname: "user_purchaser",
- label:__("Purchaser"), "default": 1, static: 1,
- hidden: frappe.setup.domain==='Education' ? 1 : 0},
- {fieldtype: "Check", fieldname: "user_accountant",
- label:__("Accountant"), "default": 1, static: 1,
- hidden: frappe.setup.domain==='Education' ? 1 : 0},
- ]
- },
-
- {
- // Sales Target
- name: 'Goals',
- domains: ['manufacturing', 'services', 'retail', 'distribution'],
- title: __("Set your Target"),
- help: __("Set a sales target you'd like to achieve."),
- fields: [
- {fieldtype:"Currency", fieldname:"sales_target", label:__("Monthly Sales Target")},
- ]
- },
-
- {
- // Taxes
- name: 'taxes',
- domains: ['manufacturing', 'services', 'retail', 'distribution'],
- icon: "fa fa-money",
- title: __("Add Taxes"),
- help: __("List your tax heads (e.g. VAT, Customs etc; they should have unique names) and their standard rates. This will create a standard template, which you can edit and add more later."),
- add_more: 1,
- max_count: 3,
- mandatory_entry: 0,
- fields: [
- {fieldtype:"Section Break"},
- {fieldtype:"Data", fieldname:"tax", label:__("Tax"),
- placeholder:__("e.g. VAT")},
- {fieldtype:"Column Break"},
- {fieldtype:"Float", fieldname:"tax_rate", label:__("Rate (%)"), placeholder:__("e.g. 5")}
- ]
- },
-
- {
- // Customers
- name: 'customers',
- domains: ['manufacturing', 'services', 'retail', 'distribution'],
- icon: "fa fa-group",
- title: __("Add Customers"),
- help: __("List a few of your customers. They could be organizations or individuals."),
- add_more: 1,
- max_count: 5,
- mandatory_entry: 1,
- fields: [
- {fieldtype:"Section Break"},
- {fieldtype:"Data", fieldname:"customer", label:__("Customer"),
- placeholder:__("Customer Name")},
- {fieldtype:"Column Break"},
- {fieldtype:"Data", fieldname:"customer_contact",
- label:__("Contact Name"), placeholder:__("Contact Name")}
- ],
- },
-
- {
- // Suppliers
- name: 'suppliers',
- domains: ['manufacturing', 'services', 'retail', 'distribution'],
- icon: "fa fa-group",
- title: __("Your Suppliers"),
- help: __("List a few of your suppliers. They could be organizations or individuals."),
- add_more: 1,
- max_count: 5,
- mandatory_entry: 1,
- fields: [
- {fieldtype:"Section Break"},
- {fieldtype:"Data", fieldname:"supplier", label:__("Supplier"),
- placeholder:__("Supplier Name")},
- {fieldtype:"Column Break"},
- {fieldtype:"Data", fieldname:"supplier_contact",
- label:__("Contact Name"), placeholder:__("Contact Name")},
- ]
- },
-
- {
- // Products
- name: 'products',
- domains: ['manufacturing', 'services', 'retail', 'distribution'],
- icon: "fa fa-barcode",
- 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."),
- add_more: 1,
- max_count: 5,
- mandatory_entry: 1,
- fields: [
- {fieldtype:"Section Break", show_section_border: true},
- {fieldtype:"Data", fieldname:"item", label:__("Item"),
- placeholder:__("A Product or Service")},
- {fieldtype:"Select", label:__("Group"), fieldname:"item_group",
- options:[__("Products"), __("Services"),
- __("Raw Material"), __("Consumable"), __("Sub Assemblies")],
- "default": __("Products"), static: 1},
- {fieldtype:"Select", fieldname:"item_uom", label:__("UOM"),
- options:[__("Unit"), __("Nos"), __("Box"), __("Pair"), __("Kg"), __("Set"),
- __("Hour"), __("Minute"), __("Litre"), __("Meter"), __("Gram")],
- "default": __("Unit"), static: 1},
- {fieldtype: "Check", fieldname: "is_sales_item",
- label:__("We sell this Item"), default: 1, static: 1},
- {fieldtype: "Check", fieldname: "is_purchase_item",
- label:__("We buy this Item"), default: 1, static: 1},
- {fieldtype:"Column Break"},
- {fieldtype:"Currency", fieldname:"item_price", label:__("Rate"), static: 1},
- {fieldtype:"Attach Image", fieldname:"item_img", label:__("Attach Image"), is_private: 0, static: 1},
- ],
- get_item_count: function() {
- return this.item_count;
- }
- },
-
- {
- // Program
- name: 'program',
- domains: ["education"],
- title: __("Program"),
- help: __("Example: Masters in Computer Science"),
- add_more: 1,
- max_count: 5,
- mandatory_entry: 1,
- fields: [
- {fieldtype:"Section Break", show_section_border: true},
- {fieldtype:"Data", fieldname:"program", label:__("Program"), placeholder: __("Program Name")},
- ],
- },
-
- {
- // Course
- name: 'course',
- domains: ["education"],
- title: __("Course"),
- help: __("Example: Basic Mathematics"),
- add_more: 1,
- max_count: 5,
- mandatory_entry: 1,
- fields: [
- {fieldtype:"Section Break", show_section_border: true},
- {fieldtype:"Data", fieldname:"course", label:__("Course"), placeholder: __("Course Name")},
- ]
- },
-
- {
- // Instructor
- name: 'instructor',
- domains: ["education"],
- title: __("Instructor"),
- help: __("People who teach at your organisation"),
- add_more: 1,
- max_count: 5,
- mandatory_entry: 1,
- fields: [
- {fieldtype:"Section Break", show_section_border: true},
- {fieldtype:"Data", fieldname:"instructor", label:__("Instructor"), placeholder: __("Instructor Name")},
- ]
- },
-
- {
- // Room
- name: 'room',
- domains: ["education"],
- title: __("Room"),
- help: __("Classrooms/ Laboratories etc where lectures can be scheduled."),
- add_more: 1,
- max_count: 3,
- mandatory_entry: 1,
- fields: [
- {fieldtype:"Section Break", show_section_border: true},
- {fieldtype:"Data", fieldname:"room", label:__("Room")},
- {fieldtype:"Column Break"},
- {fieldtype:"Int", fieldname:"room_capacity", label:__("Room") + " Capacity", static: 1},
- ]
- },
-
- {
- // last slide: Sample Data
- name: 'bootstrap',
- domains: ["all"],
- title: __("Sample Data"),
- fields: [{fieldtype: "Section Break"},
- {fieldtype: "Check", fieldname: "add_sample_data",
- label: __("Add a few sample records"), "default": 1},
- {fieldtype: "Check", fieldname: "setup_website",
- label: __("Setup a simple website for my organization"), "default": 1}
- ]
}
];
@@ -422,23 +225,19 @@
"United Kingdom": ["04-01", "03-31"],
};
-frappe.setup.on("before_load", function () {
- erpnext_slides.map(frappe.setup.add_slide);
-});
-
-var test_values_edu = {
- "language": "english",
- "domain": "Education",
- "country": "India",
- "timezone": "Asia/Kolkata",
- "currency": "INR",
- "first_name": "Tester",
- "email": "test@example.com",
- "password": "test",
- "company_name": "Hogwarts",
- "company_abbr": "HS",
- "company_tagline": "School for magicians",
- "bank_account": "Gringotts Wizarding Bank",
- "fy_start_date": "2016-04-01",
- "fy_end_date": "2017-03-31"
-}
+// var test_values_edu = {
+// "language": "english",
+// "domain": "Education",
+// "country": "India",
+// "timezone": "Asia/Kolkata",
+// "currency": "INR",
+// "first_name": "Tester",
+// "email": "test@example.com",
+// "password": "test",
+// "company_name": "Hogwarts",
+// "company_abbr": "HS",
+// "company_tagline": "School for magicians",
+// "bank_account": "Gringotts Wizarding Bank",
+// "fy_start_date": "2016-04-01",
+// "fy_end_date": "2017-03-31"
+// }