Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 1 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors |
| 2 | # License: GNU General Public License v3. See license.txt |
| 3 | |
| 4 | import frappe, erpnext |
| 5 | from frappe import _ |
| 6 | from erpnext.setup.doctype.setup_progress.setup_progress import get_action_completed_state |
| 7 | |
| 8 | def get_slide_settings(): |
| 9 | defaults = frappe.defaults.get_defaults() |
| 10 | domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain') |
| 11 | company = defaults.get("company") or '' |
Prateeksha Singh | 242218d | 2017-09-13 18:41:01 +0530 | [diff] [blame] | 12 | currency = defaults.get("currency") or '' |
| 13 | |
| 14 | doc = frappe.get_doc("Setup Progress") |
| 15 | item = [d for d in doc.get("actions") if d.action_name == "Set Sales Target"][0] |
| 16 | item.action_document = company |
| 17 | item.save() |
| 18 | doc.save() |
| 19 | |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 20 | # Initial state of slides |
| 21 | return [ |
| 22 | frappe._dict( |
Prateeksha Singh | ada8ba9 | 2017-09-26 13:07:24 +0530 | [diff] [blame] | 23 | action_name='Add Company', |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 24 | title=_("Setup Company") if domain != 'Education' else _("Setup Institution"), |
| 25 | help=_('Setup your ' + ('company' if domain != 'Education' else 'institution') + ' and brand.'), |
| 26 | # image_src="/assets/erpnext/images/illustrations/shop.jpg", |
| 27 | fields=[], |
| 28 | done_state_title=_("You added " + company), |
| 29 | done_state_title_route=["Form", "Company", company], |
| 30 | help_links=[ |
| 31 | { |
| 32 | "label": _("Chart of Accounts"), |
| 33 | "url": ["https://erpnext.org/docs/user/manual/en/accounts/chart-of-accounts"] |
| 34 | }, |
| 35 | { |
| 36 | "label": _("Opening Balances"), |
| 37 | "video_id": "U5wPIvEn-0c" |
| 38 | } |
| 39 | ] |
Prateeksha Singh | 242218d | 2017-09-13 18:41:01 +0530 | [diff] [blame] | 40 | ), |
| 41 | frappe._dict( |
| 42 | action_name='Set Sales Target', |
| 43 | domains=('Manufacturing', 'Services', 'Retail', 'Distribution'), |
| 44 | title=_("Set a Target"), |
| 45 | help=_("Set a sales goal you'd like to achieve for your company."), |
| 46 | fields=[ |
| 47 | {"fieldtype":"Currency", "fieldname":"monthly_sales_target", |
| 48 | "label":_("Monthly Sales Target (" + currency + ")")}, |
| 49 | ], |
| 50 | submit_method="erpnext.utilities.user_progress_utils.set_sales_target", |
| 51 | done_state_title=_("Go to " + company), |
| 52 | done_state_title_route=["Form", "Company", company], |
| 53 | help_links=[ |
| 54 | { |
| 55 | "label": _('Learn More'), |
| 56 | "url": ["https://erpnext.org/docs/user/manual/en/setting-up/setting-company-sales-goal"] |
| 57 | } |
| 58 | ] |
| 59 | ), |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 60 | frappe._dict( |
Prateeksha Singh | ada8ba9 | 2017-09-26 13:07:24 +0530 | [diff] [blame] | 61 | action_name='Add Customers', |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 62 | domains=('Manufacturing', 'Services', 'Retail', 'Distribution'), |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 63 | title=_("Add Customers"), |
| 64 | help=_("List a few of your customers. They could be organizations or individuals."), |
| 65 | fields=[ |
| 66 | {"fieldtype":"Section Break"}, |
| 67 | {"fieldtype":"Data", "fieldname":"customer", "label":_("Customer"), |
| 68 | "placeholder":_("Customer Name")}, |
| 69 | {"fieldtype":"Column Break"}, |
| 70 | {"fieldtype":"Data", "fieldname":"customer_contact", |
| 71 | "label":_("Contact Name"), "placeholder":_("Contact Name")} |
| 72 | ], |
| 73 | add_more=1, max_count=3, mandatory_entry=1, |
| 74 | submit_method="erpnext.utilities.user_progress_utils.create_customers", |
| 75 | done_state_title=_("Go to Customers"), |
| 76 | done_state_title_route=["List", "Customer"], |
| 77 | help_links=[ |
| 78 | { |
| 79 | "label": _('Learn More'), |
| 80 | "url": ["https://erpnext.org/docs/user/manual/en/CRM/customer.html"] |
| 81 | } |
| 82 | ] |
| 83 | ), |
Shreya Shah | 8d9edbf | 2017-11-28 16:09:58 +0530 | [diff] [blame] | 84 | |
| 85 | frappe._dict( |
| 86 | action_name='Add Letterhead', |
| 87 | domains=('Manufacturing', 'Services', 'Retail', 'Distribution', 'Education'), |
| 88 | title=_("Add Letterhead"), |
| 89 | help=_("Upload your letter head (Keep it web friendly as 900px by 100px)"), |
| 90 | fields=[ |
| 91 | {"fieldtype":"Attach Image", "fieldname":"letterhead", |
| 92 | "is_private": 0, |
| 93 | "align": "center" |
| 94 | }, |
| 95 | ], |
| 96 | mandatory_entry=1, |
| 97 | submit_method="erpnext.utilities.user_progress_utils.create_letterhead", |
| 98 | done_state_title=_("Go to Letterheads"), |
| 99 | done_state_title_route=["List", "Letter Head"] |
| 100 | ), |
| 101 | |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 102 | frappe._dict( |
Prateeksha Singh | ada8ba9 | 2017-09-26 13:07:24 +0530 | [diff] [blame] | 103 | action_name='Add Suppliers', |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 104 | domains=('Manufacturing', 'Services', 'Retail', 'Distribution'), |
| 105 | icon="fa fa-group", |
| 106 | title=_("Your Suppliers"), |
| 107 | help=_("List a few of your suppliers. They could be organizations or individuals."), |
| 108 | fields=[ |
| 109 | {"fieldtype":"Section Break"}, |
| 110 | {"fieldtype":"Data", "fieldname":"supplier", "label":_("Supplier"), |
| 111 | "placeholder":_("Supplier Name")}, |
| 112 | {"fieldtype":"Column Break"}, |
| 113 | {"fieldtype":"Data", "fieldname":"supplier_contact", |
| 114 | "label":_("Contact Name"), "placeholder":_("Contact Name")}, |
| 115 | ], |
| 116 | add_more=1, max_count=3, mandatory_entry=1, |
| 117 | submit_method="erpnext.utilities.user_progress_utils.create_suppliers", |
| 118 | done_state_title=_("Go to Suppliers"), |
| 119 | done_state_title_route=["List", "Supplier"], |
| 120 | help_links=[ |
| 121 | { |
| 122 | "label": _('Learn More'), |
| 123 | "url": ["https://erpnext.org/docs/user/manual/en/buying/supplier"] |
| 124 | }, |
| 125 | { |
| 126 | "label": _('Customers and Suppliers'), |
| 127 | "video_id": "zsrrVDk6VBs" |
| 128 | }, |
| 129 | ] |
| 130 | ), |
| 131 | frappe._dict( |
Prateeksha Singh | ada8ba9 | 2017-09-26 13:07:24 +0530 | [diff] [blame] | 132 | action_name='Add Products', |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 133 | domains=['Manufacturing', 'Services', 'Retail', 'Distribution'], |
| 134 | icon="fa fa-barcode", |
| 135 | title=_("Your Products or Services"), |
| 136 | help=_("List your products or services that you buy or sell."), |
| 137 | fields=[ |
| 138 | {"fieldtype":"Section Break", "show_section_border": 1}, |
| 139 | {"fieldtype":"Data", "fieldname":"item", "label":_("Item"), |
| 140 | "placeholder":_("A Product")}, |
| 141 | {"fieldtype":"Column Break"}, |
| 142 | {"fieldtype":"Select", "fieldname":"item_uom", "label":_("UOM"), |
| 143 | "options":[_("Unit"), _("Nos"), _("Box"), _("Pair"), _("Kg"), _("Set"), |
| 144 | _("Hour"), _("Minute"), _("Litre"), _("Meter"), _("Gram")], |
| 145 | "default": _("Unit"), "static": 1}, |
| 146 | {"fieldtype":"Column Break"}, |
| 147 | {"fieldtype":"Currency", "fieldname":"item_price", "label":_("Rate"), "static": 1} |
| 148 | ], |
| 149 | add_more=1, max_count=3, mandatory_entry=1, |
| 150 | submit_method="erpnext.utilities.user_progress_utils.create_items", |
| 151 | done_state_title=_("Go to Items"), |
| 152 | done_state_title_route=["List", "Item"], |
| 153 | help_links=[ |
| 154 | { |
| 155 | "label": _("Explore Sales Cycle"), |
| 156 | "video_id": "1eP90MWoDQM" |
| 157 | }, |
| 158 | ] |
| 159 | ), |
| 160 | |
Manas Solanki | 966f141 | 2017-11-23 15:22:10 +0530 | [diff] [blame] | 161 | # Education slides begin |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 162 | frappe._dict( |
Prateeksha Singh | ada8ba9 | 2017-09-26 13:07:24 +0530 | [diff] [blame] | 163 | action_name='Add Programs', |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 164 | domains=("Education"), |
| 165 | title=_("Program"), |
| 166 | help=_("Example: Masters in Computer Science"), |
| 167 | fields=[ |
| 168 | {"fieldtype":"Section Break", "show_section_border": 1}, |
| 169 | {"fieldtype":"Data", "fieldname":"program", "label":_("Program"), "placeholder": _("Program Name")}, |
| 170 | ], |
| 171 | add_more=1, max_count=3, mandatory_entry=1, |
| 172 | submit_method="erpnext.utilities.user_progress_utils.create_program", |
| 173 | done_state_title=_("Go to Programs"), |
| 174 | done_state_title_route=["List", "Program"], |
| 175 | help_links=[ |
| 176 | { |
| 177 | "label": _("Student Application"), |
| 178 | "video_id": "l8PUACusN3E" |
| 179 | }, |
| 180 | ] |
| 181 | |
| 182 | ), |
| 183 | frappe._dict( |
Prateeksha Singh | ada8ba9 | 2017-09-26 13:07:24 +0530 | [diff] [blame] | 184 | action_name='Add Courses', |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 185 | domains=["Education"], |
| 186 | title=_("Course"), |
| 187 | help=_("Example: Basic Mathematics"), |
| 188 | fields=[ |
| 189 | {"fieldtype":"Section Break", "show_section_border": 1}, |
| 190 | {"fieldtype":"Data", "fieldname":"course", "label":_("Course"), "placeholder": _("Course Name")}, |
| 191 | ], |
| 192 | add_more=1, max_count=3, mandatory_entry=1, |
| 193 | submit_method="erpnext.utilities.user_progress_utils.create_course", |
| 194 | done_state_title=_("Go to Courses"), |
| 195 | done_state_title_route=["List", "Course"], |
| 196 | help_links=[ |
| 197 | { |
| 198 | "label": _('Add Students'), |
| 199 | "route": ["List", "Student"] |
| 200 | } |
| 201 | ] |
| 202 | ), |
| 203 | frappe._dict( |
Prateeksha Singh | ada8ba9 | 2017-09-26 13:07:24 +0530 | [diff] [blame] | 204 | action_name='Add Instructors', |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 205 | domains=["Education"], |
| 206 | title=_("Instructor"), |
| 207 | help=_("People who teach at your organisation"), |
| 208 | fields=[ |
| 209 | {"fieldtype":"Section Break", "show_section_border": 1}, |
| 210 | {"fieldtype":"Data", "fieldname":"instructor", "label":_("Instructor"), "placeholder": _("Instructor Name")}, |
| 211 | ], |
| 212 | add_more=1, max_count=3, mandatory_entry=1, |
| 213 | submit_method="erpnext.utilities.user_progress_utils.create_instructor", |
| 214 | done_state_title=_("Go to Instructors"), |
| 215 | done_state_title_route=["List", "Instructor"], |
| 216 | help_links=[ |
| 217 | { |
| 218 | "label": _('Student Batches'), |
| 219 | "route": ["List", "Student Batch"] |
| 220 | } |
| 221 | ] |
| 222 | ), |
| 223 | frappe._dict( |
Prateeksha Singh | ada8ba9 | 2017-09-26 13:07:24 +0530 | [diff] [blame] | 224 | action_name='Add Rooms', |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 225 | domains=["Education"], |
| 226 | title=_("Room"), |
| 227 | help=_("Classrooms/ Laboratories etc where lectures can be scheduled."), |
| 228 | fields=[ |
| 229 | {"fieldtype":"Section Break", "show_section_border": 1}, |
| 230 | {"fieldtype":"Data", "fieldname":"room", "label":_("Room")}, |
| 231 | {"fieldtype":"Column Break"}, |
| 232 | {"fieldtype":"Int", "fieldname":"room_capacity", "label":_("Room Capacity"), "static": 1}, |
| 233 | ], |
| 234 | add_more=1, max_count=3, mandatory_entry=1, |
| 235 | submit_method="erpnext.utilities.user_progress_utils.create_room", |
| 236 | done_state_title=_("Go to Rooms"), |
| 237 | done_state_title_route=["List", "Room"], |
| 238 | help_links=[] |
| 239 | ), |
Manas Solanki | 966f141 | 2017-11-23 15:22:10 +0530 | [diff] [blame] | 240 | # Education slides end |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 241 | |
| 242 | frappe._dict( |
Prateeksha Singh | ada8ba9 | 2017-09-26 13:07:24 +0530 | [diff] [blame] | 243 | action_name='Add Users', |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 244 | title=_("Add Users"), |
| 245 | help=_("Add users to your organization, other than yourself."), |
| 246 | fields=[ |
| 247 | {"fieldtype":"Section Break"}, |
| 248 | {"fieldtype":"Data", "fieldname":"user_email", "label":_("Email ID"), |
| 249 | "placeholder":_("user@example.com"), "options": "Email", "static": 1}, |
| 250 | {"fieldtype":"Column Break"}, |
| 251 | {"fieldtype":"Data", "fieldname":"user_fullname", |
| 252 | "label":_("Full Name"), "static": 1}, |
| 253 | ], |
| 254 | add_more=1, max_count=3, mandatory_entry=1, |
| 255 | submit_method="erpnext.utilities.user_progress_utils.create_users", |
| 256 | done_state_title=_("Go to Users"), |
| 257 | done_state_title_route=["List", "User"], |
| 258 | help_links=[ |
| 259 | { |
| 260 | "label": _('Learn More'), |
| 261 | "url": ["https://erpnext.org/docs/user/manual/en/setting-up/users-and-permissions"] |
| 262 | }, |
| 263 | { |
| 264 | "label": _('Users and Permissions'), |
| 265 | "video_id": "8Slw1hsTmUI" |
| 266 | }, |
| 267 | ] |
| 268 | ) |
| 269 | ] |
| 270 | |
| 271 | def get_user_progress_slides(): |
| 272 | slides = [] |
| 273 | slide_settings = get_slide_settings() |
| 274 | |
Prateeksha Singh | 7351709 | 2017-12-06 13:28:06 +0530 | [diff] [blame] | 275 | domains = frappe.get_active_domains() |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 276 | for s in slide_settings: |
Prateeksha Singh | 7351709 | 2017-12-06 13:28:06 +0530 | [diff] [blame] | 277 | if not s.domains or any(d in domains for d in s.domains): |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 278 | s.mark_as_done_method = "erpnext.setup.doctype.setup_progress.setup_progress.set_action_completed_state" |
| 279 | s.done = get_action_completed_state(s.action_name) or 0 |
| 280 | slides.append(s) |
| 281 | |
| 282 | return slides |
| 283 | |