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