Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 1 | frappe.provide("erpnext.wiz"); |
| 2 | |
| 3 | frappe.pages['setup-wizard'].on_page_load = function(wrapper) { |
| 4 | if(sys_defaults.company) { |
| 5 | frappe.set_route("desk"); |
| 6 | return; |
| 7 | } |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 8 | }; |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 9 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 10 | function load_erpnext_slides() { |
| 11 | $.extend(erpnext.wiz, { |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 12 | select_domain: { |
| 13 | domains: ["all"], |
| 14 | title: __('Select your Domain'), |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 15 | fields: [ |
Neil Trini Lasrado | 342895c | 2016-03-04 15:41:27 +0530 | [diff] [blame] | 16 | {fieldname:'domain', label: __('Domain'), fieldtype:'Select', |
Neil Trini Lasrado | 1b03e0a | 2016-03-07 16:57:05 +0530 | [diff] [blame] | 17 | options: [ |
Anand Doshi | 0179242 | 2016-03-09 16:31:53 +0530 | [diff] [blame] | 18 | {"label": __("Distribution"), "value": "Distribution"}, |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 19 | {"label": __("Education"), "value": "Education"}, |
Anand Doshi | 0179242 | 2016-03-09 16:31:53 +0530 | [diff] [blame] | 20 | {"label": __("Manufacturing"), "value": "Manufacturing"}, |
| 21 | {"label": __("Retail"), "value": "Retail"}, |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 22 | {"label": __("Services"), "value": "Services"} |
Neil Trini Lasrado | 1b03e0a | 2016-03-07 16:57:05 +0530 | [diff] [blame] | 23 | ], reqd:1}, |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 24 | ], |
| 25 | help: __('Select the nature of your business.'), |
| 26 | onload: function(slide) { |
| 27 | slide.get_input("domain").on("change", function() { |
| 28 | frappe.wiz.domain = $(this).val(); |
| 29 | frappe.wizard.refresh_slides(); |
| 30 | }); |
| 31 | }, |
| 32 | css_class: "single-column" |
| 33 | }, |
| 34 | org: { |
| 35 | domains: ["all"], |
| 36 | title: __("The Organization"), |
Rushabh Mehta | 323c06e | 2016-12-05 14:17:26 +0530 | [diff] [blame] | 37 | icon: "fa fa-building", |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 38 | fields: [ |
| 39 | {fieldname:'company_name', |
| 40 | label: frappe.wiz.domain==='Education' ? |
| 41 | __('Institute Name') : __('Company Name'), |
| 42 | fieldtype:'Data', reqd:1}, |
| 43 | {fieldname:'company_abbr', |
| 44 | label: frappe.wiz.domain==='Education' ? |
| 45 | __('Institute Abbreviation') : __('Company Abbreviation'), |
| 46 | fieldtype:'Data'}, |
| 47 | {fieldname:'company_tagline', |
| 48 | label: __('What does it do?'), |
| 49 | fieldtype:'Data', |
| 50 | placeholder: frappe.wiz.domain==='Education' ? |
| 51 | __('e.g. "Primary School" or "University"') : |
| 52 | __('e.g. "Build tools for builders"'), |
| 53 | reqd:1}, |
| 54 | {fieldname:'bank_account', label: __('Bank Name'), fieldtype:'Data', reqd:1}, |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 55 | {fieldname:'chart_of_accounts', label: __('Chart of Accounts'), |
| 56 | options: "", fieldtype: 'Select'}, |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 57 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 58 | // TODO remove this |
| 59 | {fieldtype: "Section Break"}, |
| 60 | {fieldname:'fy_start_date', label:__('Financial Year Start Date'), fieldtype:'Date', |
| 61 | description: __('Your financial year begins on'), reqd:1}, |
| 62 | {fieldname:'fy_end_date', label:__('Financial Year End Date'), fieldtype:'Date', |
| 63 | description: __('Your financial year ends on'), reqd:1}, |
| 64 | ], |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 65 | help: (frappe.wiz.domain==='Education' ? |
| 66 | __('The name of the institute for which you are setting up this system.'): |
| 67 | __('The name of your company for which you are setting up this system.')), |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 68 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 69 | onload: function(slide) { |
| 70 | erpnext.wiz.org.load_chart_of_accounts(slide); |
| 71 | erpnext.wiz.org.bind_events(slide); |
| 72 | erpnext.wiz.org.set_fy_dates(slide); |
| 73 | }, |
| 74 | |
Anand Doshi | 5c3469a | 2015-11-24 17:06:54 +0530 | [diff] [blame] | 75 | validate: function() { |
| 76 | // validate fiscal year start and end dates |
| 77 | if (this.values.fy_start_date=='Invalid date' || this.values.fy_end_date=='Invalid date') { |
| 78 | msgprint(__("Please enter valid Financial Year Start and End Dates")); |
| 79 | return false; |
| 80 | } |
| 81 | |
| 82 | if ((this.values.company_name || "").toLowerCase() == "company") { |
| 83 | msgprint(__("Company Name cannot be Company")); |
| 84 | return false; |
| 85 | } |
| 86 | |
| 87 | return true; |
| 88 | }, |
| 89 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 90 | css_class: "single-column", |
| 91 | |
| 92 | set_fy_dates: function(slide) { |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 93 | var country = frappe.wizard.values.country; |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 94 | |
| 95 | if(country) { |
| 96 | var fy = erpnext.wiz.fiscal_years[country]; |
| 97 | var current_year = moment(new Date()).year(); |
| 98 | var next_year = current_year + 1; |
| 99 | if(!fy) { |
| 100 | fy = ["01-01", "12-31"]; |
| 101 | next_year = current_year; |
| 102 | } |
Nabin Hait | 6af7dd4 | 2017-02-17 14:47:25 +0530 | [diff] [blame] | 103 | |
| 104 | var year_start_date = current_year + "-" + fy[0]; |
| 105 | if(year_start_date > get_today()) { |
| 106 | next_year = current_year |
| 107 | current_year -= 1; |
| 108 | } |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 109 | slide.get_field("fy_start_date").set_input(current_year + "-" + fy[0]); |
| 110 | slide.get_field("fy_end_date").set_input(next_year + "-" + fy[1]); |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 111 | } |
| 112 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 113 | }, |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 114 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 115 | load_chart_of_accounts: function(slide) { |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 116 | var country = frappe.wizard.values.country; |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 117 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 118 | if(country) { |
| 119 | frappe.call({ |
| 120 | method: "erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts.get_charts_for_country", |
| 121 | args: {"country": country}, |
| 122 | callback: function(r) { |
| 123 | if(r.message) { |
| 124 | slide.get_input("chart_of_accounts").empty() |
| 125 | .add_options(r.message); |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 126 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 127 | if (r.message.length===1) { |
| 128 | var field = slide.get_field("chart_of_accounts"); |
| 129 | field.set_value(r.message[0]); |
| 130 | field.df.hidden = 1; |
| 131 | field.refresh(); |
| 132 | } |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 133 | } |
| 134 | } |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 135 | }) |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 136 | } |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 137 | }, |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 138 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 139 | bind_events: function(slide) { |
| 140 | slide.get_input("company_name").on("change", function() { |
| 141 | var parts = slide.get_input("company_name").val().split(" "); |
| 142 | var abbr = $.map(parts, function(p) { return p ? p.substr(0,1) : null }).join(""); |
| 143 | slide.get_field("company_abbr").set_input(abbr.slice(0, 5).toUpperCase()); |
| 144 | }).val(frappe.boot.sysdefaults.company_name || "").trigger("change"); |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 145 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 146 | slide.get_input("company_abbr").on("change", function() { |
| 147 | if(slide.get_input("company_abbr").val().length > 5) { |
| 148 | msgprint("Company Abbreviation cannot have more than 5 characters"); |
| 149 | slide.get_field("company_abbr").set_input(""); |
| 150 | } |
| 151 | }); |
| 152 | |
| 153 | // TODO remove this |
| 154 | slide.get_input("fy_start_date").on("change", function() { |
| 155 | var year_end_date = |
| 156 | frappe.datetime.add_days(frappe.datetime.add_months( |
| 157 | frappe.datetime.user_to_obj(slide.get_input("fy_start_date").val()), 12), -1); |
| 158 | slide.get_input("fy_end_date").val(frappe.datetime.obj_to_user(year_end_date)); |
| 159 | |
| 160 | }); |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 161 | } |
| 162 | }, |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 163 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 164 | branding: { |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 165 | domains: ["all"], |
Rushabh Mehta | 323c06e | 2016-12-05 14:17:26 +0530 | [diff] [blame] | 166 | icon: "fa fa-bookmark", |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 167 | title: __("The Brand"), |
| 168 | help: __('Upload your letter head and logo. (you can edit them later).'), |
| 169 | fields: [ |
| 170 | {fieldtype:"Attach Image", fieldname:"attach_letterhead", |
| 171 | label: __("Attach Letterhead"), |
Anand Doshi | 2af44ff | 2015-12-09 17:28:51 +0530 | [diff] [blame] | 172 | description: __("Keep it web friendly 900px (w) by 100px (h)"), |
| 173 | is_private: 0 |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 174 | }, |
| 175 | {fieldtype: "Column Break"}, |
| 176 | {fieldtype:"Attach Image", fieldname:"attach_logo", |
| 177 | label:__("Attach Logo"), |
Anand Doshi | 2af44ff | 2015-12-09 17:28:51 +0530 | [diff] [blame] | 178 | description: __("100px by 100px"), |
| 179 | is_private: 0 |
| 180 | }, |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 181 | ], |
| 182 | |
| 183 | css_class: "two-column" |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 184 | }, |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 185 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 186 | users: { |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 187 | domains: ["all"], |
Rushabh Mehta | 323c06e | 2016-12-05 14:17:26 +0530 | [diff] [blame] | 188 | icon: "fa fa-money", |
Neil Trini Lasrado | 3c0d5cb | 2016-02-24 15:58:25 +0530 | [diff] [blame] | 189 | title: __("Add Users"), |
| 190 | help: __("Add users to your organization, other than yourself"), |
| 191 | fields: [], |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 192 | before_load: function(slide) { |
| 193 | slide.fields = []; |
| 194 | for(var i=1; i<5; i++) { |
| 195 | slide.fields = slide.fields.concat([ |
| 196 | {fieldtype:"Section Break"}, |
| 197 | {fieldtype:"Data", fieldname:"user_fullname_"+ i, |
| 198 | label:__("Full Name")}, |
| 199 | {fieldtype:"Data", fieldname:"user_email_" + i, |
Kanchan Chauhan | b7cc393 | 2017-01-03 16:45:38 +0530 | [diff] [blame] | 200 | label:__("Email Address"), placeholder:__("user@example.com"), |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 201 | options: "Email"}, |
| 202 | {fieldtype:"Column Break"}, |
| 203 | {fieldtype: "Check", fieldname: "user_sales_" + i, |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 204 | label:__("Sales"), "default": 1, |
| 205 | hidden: frappe.wiz.domain==='Education' ? 1 : 0}, |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 206 | {fieldtype: "Check", fieldname: "user_purchaser_" + i, |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 207 | label:__("Purchaser"), "default": 1, |
| 208 | hidden: frappe.wiz.domain==='Education' ? 1 : 0}, |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 209 | {fieldtype: "Check", fieldname: "user_accountant_" + i, |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 210 | label:__("Accountant"), "default": 1, |
| 211 | hidden: frappe.wiz.domain==='Education' ? 1 : 0}, |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 212 | ]); |
| 213 | } |
| 214 | }, |
| 215 | css_class: "two-column" |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 216 | }, |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 217 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 218 | taxes: { |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 219 | domains: ['manufacturing', 'services', 'retail', 'distribution'], |
Rushabh Mehta | 323c06e | 2016-12-05 14:17:26 +0530 | [diff] [blame] | 220 | icon: "fa fa-money", |
Neil Trini Lasrado | 3c0d5cb | 2016-02-24 15:58:25 +0530 | [diff] [blame] | 221 | title: __("Add Taxes"), |
| 222 | 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."), |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 223 | "fields": [], |
| 224 | before_load: function(slide) { |
| 225 | slide.fields = []; |
| 226 | for(var i=1; i<4; i++) { |
| 227 | slide.fields = slide.fields.concat([ |
| 228 | {fieldtype:"Section Break"}, |
| 229 | {fieldtype:"Data", fieldname:"tax_"+ i, label:__("Tax") + " " + i, |
| 230 | placeholder:__("e.g. VAT") + " " + i}, |
| 231 | {fieldtype:"Column Break"}, |
| 232 | {fieldtype:"Float", fieldname:"tax_rate_" + i, label:__("Rate (%)"), placeholder:__("e.g. 5")}, |
| 233 | ]); |
| 234 | } |
| 235 | }, |
| 236 | css_class: "two-column" |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 237 | }, |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 238 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 239 | customers: { |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 240 | domains: ['manufacturing', 'services', 'retail', 'distribution'], |
Rushabh Mehta | 323c06e | 2016-12-05 14:17:26 +0530 | [diff] [blame] | 241 | icon: "fa fa-group", |
Neil Trini Lasrado | 3c0d5cb | 2016-02-24 15:58:25 +0530 | [diff] [blame] | 242 | title: __("Your Customers"), |
| 243 | help: __("List a few of your customers. They could be organizations or individuals."), |
| 244 | fields: [], |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 245 | before_load: function(slide) { |
| 246 | slide.fields = []; |
| 247 | for(var i=1; i<6; i++) { |
| 248 | slide.fields = slide.fields.concat([ |
| 249 | {fieldtype:"Section Break"}, |
| 250 | {fieldtype:"Data", fieldname:"customer_" + i, label:__("Customer") + " " + i, |
| 251 | placeholder:__("Customer Name")}, |
| 252 | {fieldtype:"Column Break"}, |
| 253 | {fieldtype:"Data", fieldname:"customer_contact_" + i, |
| 254 | label:__("Contact Name") + " " + i, placeholder:__("Contact Name")} |
| 255 | ]) |
| 256 | } |
| 257 | slide.fields[1].reqd = 1; |
| 258 | }, |
| 259 | css_class: "two-column" |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 260 | }, |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 261 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 262 | suppliers: { |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 263 | domains: ['manufacturing', 'services', 'retail', 'distribution'], |
Rushabh Mehta | 323c06e | 2016-12-05 14:17:26 +0530 | [diff] [blame] | 264 | icon: "fa fa-group", |
Neil Trini Lasrado | 3c0d5cb | 2016-02-24 15:58:25 +0530 | [diff] [blame] | 265 | title: __("Your Suppliers"), |
| 266 | help: __("List a few of your suppliers. They could be organizations or individuals."), |
| 267 | fields: [], |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 268 | before_load: function(slide) { |
| 269 | slide.fields = []; |
| 270 | for(var i=1; i<6; i++) { |
| 271 | slide.fields = slide.fields.concat([ |
| 272 | {fieldtype:"Section Break"}, |
| 273 | {fieldtype:"Data", fieldname:"supplier_" + i, label:__("Supplier")+" " + i, |
| 274 | placeholder:__("Supplier Name")}, |
| 275 | {fieldtype:"Column Break"}, |
| 276 | {fieldtype:"Data", fieldname:"supplier_contact_" + i, |
| 277 | label:__("Contact Name") + " " + i, placeholder:__("Contact Name")}, |
| 278 | ]) |
| 279 | } |
| 280 | slide.fields[1].reqd = 1; |
| 281 | }, |
| 282 | css_class: "two-column" |
| 283 | }, |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 284 | |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 285 | items: { |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 286 | domains: ['manufacturing', 'services', 'retail', 'distribution'], |
Rushabh Mehta | 323c06e | 2016-12-05 14:17:26 +0530 | [diff] [blame] | 287 | icon: "fa fa-barcode", |
Neil Trini Lasrado | 3c0d5cb | 2016-02-24 15:58:25 +0530 | [diff] [blame] | 288 | title: __("Your Products or Services"), |
| 289 | 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."), |
| 290 | fields: [], |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 291 | before_load: function(slide) { |
| 292 | slide.fields = []; |
| 293 | for(var i=1; i<6; i++) { |
| 294 | slide.fields = slide.fields.concat([ |
| 295 | {fieldtype:"Section Break", show_section_border: true}, |
| 296 | {fieldtype:"Data", fieldname:"item_" + i, label:__("Item") + " " + i, |
| 297 | placeholder:__("A Product or Service")}, |
| 298 | {fieldtype:"Select", label:__("Group"), fieldname:"item_group_" + i, |
| 299 | options:[__("Products"), __("Services"), |
| 300 | __("Raw Material"), __("Consumable"), __("Sub Assemblies")], |
| 301 | "default": __("Products")}, |
| 302 | {fieldtype:"Select", fieldname:"item_uom_" + i, label:__("UOM"), |
| 303 | options:[__("Unit"), __("Nos"), __("Box"), __("Pair"), __("Kg"), __("Set"), |
Rushabh Mehta | e0686b3 | 2016-06-10 12:34:41 +0530 | [diff] [blame] | 304 | __("Hour"), __("Minute"), __("Litre"), __("Meter"), __("Gram")], |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 305 | "default": __("Unit")}, |
| 306 | {fieldtype: "Check", fieldname: "is_sales_item_" + i, label:__("We sell this Item"), default: 1}, |
| 307 | {fieldtype: "Check", fieldname: "is_purchase_item_" + i, label:__("We buy this Item")}, |
| 308 | {fieldtype:"Column Break"}, |
| 309 | {fieldtype:"Currency", fieldname:"item_price_" + i, label:__("Rate")}, |
Anand Doshi | 2af44ff | 2015-12-09 17:28:51 +0530 | [diff] [blame] | 310 | {fieldtype:"Attach Image", fieldname:"item_img_" + i, label:__("Attach Image"), is_private: 0}, |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 311 | ]) |
| 312 | } |
| 313 | slide.fields[1].reqd = 1; |
| 314 | |
| 315 | // dummy data |
| 316 | slide.fields.push({fieldtype: "Section Break"}); |
| 317 | slide.fields.push({fieldtype: "Check", fieldname: "add_sample_data", |
| 318 | label: __("Add a few sample records"), "default": 1}); |
Rushabh Mehta | ec2d09c | 2016-08-09 16:43:15 +0530 | [diff] [blame] | 319 | slide.fields.push({fieldtype: "Check", fieldname: "setup_website", |
| 320 | label: __("Setup a simple website for my organization"), "default": 1}); |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 321 | }, |
| 322 | css_class: "two-column" |
| 323 | }, |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 324 | |
| 325 | program: { |
| 326 | domains: ["education"], |
| 327 | title: __("Program"), |
| 328 | help: __("Example: Masters in Computer Science"), |
| 329 | fields: [], |
| 330 | before_load: function(slide) { |
| 331 | slide.fields = []; |
| 332 | for(var i=1; i<6; i++) { |
| 333 | slide.fields = slide.fields.concat([ |
| 334 | {fieldtype:"Section Break", show_section_border: true}, |
| 335 | {fieldtype:"Data", fieldname:"program_" + i, label:__("Program") + " " + i, placeholder: __("Program Name")}, |
| 336 | ]) |
| 337 | } |
| 338 | slide.fields[1].reqd = 1; |
| 339 | }, |
| 340 | css_class: "single-column" |
| 341 | }, |
| 342 | |
| 343 | course: { |
| 344 | domains: ["education"], |
| 345 | title: __("Course"), |
| 346 | help: __("Example: Basic Mathematics"), |
| 347 | fields: [], |
| 348 | before_load: function(slide) { |
| 349 | slide.fields = []; |
| 350 | for(var i=1; i<6; i++) { |
| 351 | slide.fields = slide.fields.concat([ |
| 352 | {fieldtype:"Section Break", show_section_border: true}, |
| 353 | {fieldtype:"Data", fieldname:"course_" + i, label:__("Course") + " " + i, placeholder: __("Course Name")}, |
| 354 | ]) |
| 355 | } |
| 356 | slide.fields[1].reqd = 1; |
| 357 | }, |
| 358 | css_class: "single-column" |
| 359 | }, |
| 360 | |
| 361 | |
| 362 | instructor: { |
| 363 | domains: ["education"], |
| 364 | title: __("Instructor"), |
| 365 | help: __("People who teach at your organisation"), |
| 366 | fields: [], |
| 367 | before_load: function(slide) { |
| 368 | slide.fields = []; |
| 369 | for(var i=1; i<6; i++) { |
| 370 | slide.fields = slide.fields.concat([ |
| 371 | {fieldtype:"Section Break", show_section_border: true}, |
| 372 | {fieldtype:"Data", fieldname:"instructor_" + i, label:__("Instructor") + " " + i, placeholder: __("Instructor Name")}, |
| 373 | ]) |
| 374 | } |
| 375 | slide.fields[1].reqd = 1; |
| 376 | }, |
| 377 | css_class: "single-column" |
| 378 | }, |
| 379 | |
| 380 | room: { |
| 381 | domains: ["education"], |
| 382 | title: __("Room"), |
| 383 | help: __("Classrooms/ Laboratories etc where lectures can be scheduled."), |
| 384 | fields: [], |
| 385 | before_load: function(slide) { |
| 386 | slide.fields = []; |
| 387 | for(var i=1; i<4; i++) { |
| 388 | slide.fields = slide.fields.concat([ |
| 389 | {fieldtype:"Section Break", show_section_border: true}, |
| 390 | {fieldtype:"Data", fieldname:"room_" + i, label:__("Room") + " " + i}, |
| 391 | {fieldtype:"Column Break"}, |
| 392 | {fieldtype:"Int", fieldname:"room_capacity_" + i, label:__("Room") + " " + i + " Capacity"}, |
| 393 | ]) |
| 394 | } |
| 395 | slide.fields[1].reqd = 1; |
| 396 | }, |
| 397 | css_class: "two-column" |
| 398 | }, |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 399 | }); |
| 400 | |
| 401 | // Source: https://en.wikipedia.org/wiki/Fiscal_year |
| 402 | // default 1st Jan - 31st Dec |
| 403 | |
| 404 | erpnext.wiz.fiscal_years = { |
| 405 | "Afghanistan": ["12-20", "12-21"], |
| 406 | "Australia": ["07-01", "06-30"], |
| 407 | "Bangladesh": ["07-01", "06-30"], |
| 408 | "Canada": ["04-01", "03-31"], |
| 409 | "Costa Rica": ["10-01", "09-30"], |
| 410 | "Egypt": ["07-01", "06-30"], |
| 411 | "Hong Kong": ["04-01", "03-31"], |
| 412 | "India": ["04-01", "03-31"], |
| 413 | "Iran": ["06-23", "06-22"], |
| 414 | "Italy": ["07-01", "06-30"], |
| 415 | "Myanmar": ["04-01", "03-31"], |
| 416 | "New Zealand": ["04-01", "03-31"], |
| 417 | "Pakistan": ["07-01", "06-30"], |
| 418 | "Singapore": ["04-01", "03-31"], |
| 419 | "South Africa": ["03-01", "02-28"], |
| 420 | "Thailand": ["10-01", "09-30"], |
| 421 | "United Kingdom": ["04-01", "03-31"], |
| 422 | }; |
| 423 | }; |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 424 | |
| 425 | frappe.wiz.on("before_load", function() { |
Anand Doshi | 1ed8283 | 2015-11-16 12:58:14 +0530 | [diff] [blame] | 426 | load_erpnext_slides(); |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 427 | |
| 428 | frappe.wiz.add_slide(erpnext.wiz.select_domain); |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 429 | frappe.wiz.add_slide(erpnext.wiz.org); |
| 430 | frappe.wiz.add_slide(erpnext.wiz.branding); |
Anand Doshi | 3177138 | 2016-07-05 21:34:21 +0530 | [diff] [blame] | 431 | |
| 432 | if (!(frappe.boot.limits && frappe.boot.limits.users===1)) { |
| 433 | frappe.wiz.add_slide(erpnext.wiz.users); |
| 434 | } |
| 435 | |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 436 | frappe.wiz.add_slide(erpnext.wiz.taxes); |
| 437 | frappe.wiz.add_slide(erpnext.wiz.customers); |
| 438 | frappe.wiz.add_slide(erpnext.wiz.suppliers); |
| 439 | frappe.wiz.add_slide(erpnext.wiz.items); |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 440 | frappe.wiz.add_slide(erpnext.wiz.program); |
| 441 | frappe.wiz.add_slide(erpnext.wiz.course); |
| 442 | frappe.wiz.add_slide(erpnext.wiz.instructor); |
| 443 | frappe.wiz.add_slide(erpnext.wiz.room); |
| 444 | |
Rushabh Mehta | 7e472f8 | 2016-07-21 18:01:42 +0530 | [diff] [blame] | 445 | if(frappe.wizard && frappe.wizard.domain && frappe.wizard.domain !== 'Education') { |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 446 | frappe.wiz.welcome_page = "#welcome-to-erpnext"; |
| 447 | } |
Rushabh Mehta | 37b4d75 | 2015-11-09 16:53:11 +0530 | [diff] [blame] | 448 | }); |
Rushabh Mehta | 20038ad | 2016-07-21 16:01:59 +0530 | [diff] [blame] | 449 | |
| 450 | test_values_edu = { |
| 451 | "language":"english", |
| 452 | "domain":"Education", |
| 453 | "country":"India", |
| 454 | "timezone":"Asia/Kolkata", |
| 455 | "currency":"INR", |
| 456 | "first_name":"Tester", |
| 457 | "email":"test@example.com", |
| 458 | "password":"test", |
| 459 | "company_name":"Hogwarts", |
| 460 | "company_abbr":"HS", |
| 461 | "company_tagline":"School for magicians", |
| 462 | "bank_account":"Gringotts Wizarding Bank", |
| 463 | "fy_start_date":"2016-04-01", |
| 464 | "fy_end_date":"2017-03-31" |
| 465 | } |