chore: ERPNext setup wizard cleanup (#33675)
* chore: ERPNext setup wizard cleanup
* chore: Remove default website
* chore: Remove flaky tests
* chore: remove unwanted tests
diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js
index 9288f51..a913844 100644
--- a/erpnext/public/js/setup_wizard.js
+++ b/erpnext/public/js/setup_wizard.js
@@ -13,20 +13,12 @@
erpnext.setup.slides_settings = [
{
- // Brand
- name: 'brand',
- icon: "fa fa-bookmark",
- title: __("The Brand"),
- // help: __('Upload your letter head and logo. (you can edit them later).'),
+ // Organization
+ name: 'organization',
+ title: __("Setup your organization"),
+ icon: "fa fa-building",
fields: [
{
- fieldtype: "Attach Image", fieldname: "attach_logo",
- label: __("Attach Logo"),
- description: __("100px by 100px"),
- is_private: 0,
- align: 'center'
- },
- {
fieldname: 'company_name',
label: __('Company Name'),
fieldtype: 'Data',
@@ -35,54 +27,9 @@
{
fieldname: 'company_abbr',
label: __('Company Abbreviation'),
- fieldtype: 'Data'
- }
- ],
- onload: function(slide) {
- this.bind_events(slide);
- },
- bind_events: function (slide) {
- slide.get_input("company_name").on("change", function () {
- var parts = slide.get_input("company_name").val().split(" ");
- var abbr = $.map(parts, function (p) { return p ? p.substr(0, 1) : null }).join("");
- slide.get_field("company_abbr").set_value(abbr.slice(0, 10).toUpperCase());
- }).val(frappe.boot.sysdefaults.company_name || "").trigger("change");
-
- slide.get_input("company_abbr").on("change", function () {
- if (slide.get_input("company_abbr").val().length > 10) {
- frappe.msgprint(__("Company Abbreviation cannot have more than 5 characters"));
- slide.get_field("company_abbr").set_value("");
- }
- });
- },
- validate: function() {
- if ((this.values.company_name || "").toLowerCase() == "company") {
- frappe.msgprint(__("Company Name cannot be Company"));
- return false;
- }
- if (!this.values.company_abbr) {
- return false;
- }
- if (this.values.company_abbr.length > 10) {
- return false;
- }
- return true;
- }
- },
- {
- // Organisation
- name: 'organisation',
- title: __("Your Organization"),
- icon: "fa fa-building",
- fields: [
- {
- fieldname: 'company_tagline',
- label: __('What does it do?'),
fieldtype: 'Data',
- placeholder: __('e.g. "Build tools for builders"'),
- reqd: 1
+ hidden: 1
},
- { fieldname: 'bank_account', label: __('Bank Name'), fieldtype: 'Data', reqd: 1 },
{
fieldname: 'chart_of_accounts', label: __('Chart of Accounts'),
options: "", fieldtype: 'Select'
@@ -94,40 +41,24 @@
],
onload: function (slide) {
- this.load_chart_of_accounts(slide);
this.bind_events(slide);
+ this.load_chart_of_accounts(slide);
this.set_fy_dates(slide);
},
-
validate: function () {
- let me = this;
- let exist;
-
if (!this.validate_fy_dates()) {
return false;
}
- // Validate bank name
- if(me.values.bank_account) {
- frappe.call({
- async: false,
- method: "erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts.validate_bank_account",
- args: {
- "coa": me.values.chart_of_accounts,
- "bank_account": me.values.bank_account
- },
- callback: function (r) {
- if(r.message){
- exist = r.message;
- me.get_field("bank_account").set_value("");
- let message = __('Account {0} already exists. Please enter a different name for your bank account.',
- [me.values.bank_account]
- );
- frappe.msgprint(message);
- }
- }
- });
- return !exist; // Return False if exist = true
+ if ((this.values.company_name || "").toLowerCase() == "company") {
+ frappe.msgprint(__("Company Name cannot be Company"));
+ return false;
+ }
+ if (!this.values.company_abbr) {
+ return false;
+ }
+ if (this.values.company_abbr.length > 10) {
+ return false;
}
return true;
@@ -151,15 +82,15 @@
var country = frappe.wizard.values.country;
if (country) {
- var fy = erpnext.setup.fiscal_years[country];
- var current_year = moment(new Date()).year();
- var next_year = current_year + 1;
+ let fy = erpnext.setup.fiscal_years[country];
+ let current_year = moment(new Date()).year();
+ let next_year = current_year + 1;
if (!fy) {
fy = ["01-01", "12-31"];
next_year = current_year;
}
- var year_start_date = current_year + "-" + fy[0];
+ let year_start_date = current_year + "-" + fy[0];
if (year_start_date > frappe.datetime.get_today()) {
next_year = current_year;
current_year -= 1;
@@ -171,7 +102,7 @@
load_chart_of_accounts: function (slide) {
- var country = frappe.wizard.values.country;
+ let country = frappe.wizard.values.country;
if (country) {
frappe.call({
@@ -202,12 +133,25 @@
me.charts_modal(slide, chart_template);
});
+
+ slide.get_input("company_name").on("change", function () {
+ let parts = slide.get_input("company_name").val().split(" ");
+ let abbr = $.map(parts, function (p) { return p ? p.substr(0, 1) : null }).join("");
+ slide.get_field("company_abbr").set_value(abbr.slice(0, 10).toUpperCase());
+ }).val(frappe.boot.sysdefaults.company_name || "").trigger("change");
+
+ slide.get_input("company_abbr").on("change", function () {
+ if (slide.get_input("company_abbr").val().length > 10) {
+ frappe.msgprint(__("Company Abbreviation cannot have more than 5 characters"));
+ slide.get_field("company_abbr").set_value("");
+ }
+ });
},
charts_modal: function(slide, chart_template) {
let parent = __('All Accounts');
- var dialog = new frappe.ui.Dialog({
+ let dialog = new frappe.ui.Dialog({
title: chart_template,
fields: [
{'fieldname': 'expand_all', 'label': __('Expand All'), 'fieldtype': 'Button',