blob: 5cec3ca3846b0d10bf61dcf8bb3a9a0ec1797035 [file] [log] [blame]
Prateeksha Singh95d8fd32017-09-04 11:14:04 +05301# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
2# License: GNU General Public License v3. See license.txt
3
Aditya Hasef3c22f32019-01-22 18:22:20 +05304from __future__ import unicode_literals
Prateeksha Singh95d8fd32017-09-04 11:14:04 +05305import frappe, erpnext
6from frappe import _
7from erpnext.setup.doctype.setup_progress.setup_progress import get_action_completed_state
8
9def get_slide_settings():
10 defaults = frappe.defaults.get_defaults()
Rushabh Mehta708e47a2018-08-08 16:37:31 +053011 domain = frappe.get_cached_value('Company', erpnext.get_default_company(), 'domain')
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053012 company = defaults.get("company") or ''
Prateeksha Singh242218d2017-09-13 18:41:01 +053013 currency = defaults.get("currency") or ''
14
15 doc = frappe.get_doc("Setup Progress")
Achilles Rasquinhad0786b42018-03-19 22:17:37 +053016 item = [d for d in doc.get("actions") if d.action_name == "Set Sales Target"]
Prateeksha Singhb60a52b2018-04-03 10:44:13 +053017
Achilles Rasquinhad0786b42018-03-19 22:17:37 +053018 if len(item):
19 item = item[0]
20 if not item.action_document:
21 item.action_document = company
22 doc.save()
Prateeksha Singh242218d2017-09-13 18:41:01 +053023
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053024 # Initial state of slides
25 return [
26 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +053027 action_name='Add Company',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053028 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"),
scmmishra3f9b2312019-01-25 12:56:27 +053037 "url": ["https://erpnext.com/docs/user/manual/en/accounts/chart-of-accounts"]
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053038 },
39 {
40 "label": _("Opening Balances"),
41 "video_id": "U5wPIvEn-0c"
42 }
43 ]
Prateeksha Singh242218d2017-09-13 18:41:01 +053044 ),
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",
Zarrarbc551562018-02-21 11:13:14 +053052 "label":_("Monthly Sales Target (" + currency + ")"), "reqd":1},
Prateeksha Singh242218d2017-09-13 18:41:01 +053053 ],
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'),
scmmishra3f9b2312019-01-25 12:56:27 +053060 "url": ["https://erpnext.com/docs/user/manual/en/setting-up/setting-company-sales-goal"]
Prateeksha Singh242218d2017-09-13 18:41:01 +053061 }
62 ]
63 ),
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053064 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +053065 action_name='Add Customers',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053066 domains=('Manufacturing', 'Services', 'Retail', 'Distribution'),
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053067 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'),
scmmishra3f9b2312019-01-25 12:56:27 +053084 "url": ["https://erpnext.com/docs/user/manual/en/CRM/customer.html"]
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053085 }
86 ]
87 ),
Shreya Shah8d9edbf2017-11-28 16:09:58 +053088
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 Singh95d8fd32017-09-04 11:14:04 +0530106 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +0530107 action_name='Add Suppliers',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530108 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'),
scmmishra3f9b2312019-01-25 12:56:27 +0530127 "url": ["https://erpnext.com/docs/user/manual/en/buying/supplier"]
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530128 },
129 {
130 "label": _('Customers and Suppliers'),
131 "video_id": "zsrrVDk6VBs"
132 },
133 ]
134 ),
135 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +0530136 action_name='Add Products',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530137 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 Solanki966f1412017-11-23 15:22:10 +0530165 # Education slides begin
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530166 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +0530167 action_name='Add Programs',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530168 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 Singhada8ba92017-09-26 13:07:24 +0530188 action_name='Add Courses',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530189 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 Singhada8ba92017-09-26 13:07:24 +0530208 action_name='Add Instructors',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530209 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 Singhada8ba92017-09-26 13:07:24 +0530228 action_name='Add Rooms',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530229 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 Solanki966f1412017-11-23 15:22:10 +0530244 # Education slides end
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530245
246 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +0530247 action_name='Add Users',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530248 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'),
scmmishra3f9b2312019-01-25 12:56:27 +0530265 "url": ["https://erpnext.com/docs/user/manual/en/setting-up/users-and-permissions"]
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530266 },
267 {
268 "label": _('Users and Permissions'),
269 "video_id": "8Slw1hsTmUI"
270 },
271 ]
272 )
273 ]
274
275def get_user_progress_slides():
276 slides = []
277 slide_settings = get_slide_settings()
278
Prateeksha Singh73517092017-12-06 13:28:06 +0530279 domains = frappe.get_active_domains()
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530280 for s in slide_settings:
Prateeksha Singh73517092017-12-06 13:28:06 +0530281 if not s.domains or any(d in domains for d in s.domains):
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530282 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