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