blob: 2901d522762e186166ada62e7750625f089dc5ef [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
4import frappe, erpnext
5from frappe import _
6from erpnext.setup.doctype.setup_progress.setup_progress import get_action_completed_state
7
8def get_slide_settings():
9 defaults = frappe.defaults.get_defaults()
Rushabh Mehta708e47a2018-08-08 16:37:31 +053010 domain = frappe.get_cached_value('Company', erpnext.get_default_company(), 'domain')
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053011 company = defaults.get("company") or ''
Prateeksha Singh242218d2017-09-13 18:41:01 +053012 currency = defaults.get("currency") or ''
13
14 doc = frappe.get_doc("Setup Progress")
Achilles Rasquinhad0786b42018-03-19 22:17:37 +053015 item = [d for d in doc.get("actions") if d.action_name == "Set Sales Target"]
Prateeksha Singhb60a52b2018-04-03 10:44:13 +053016
Achilles Rasquinhad0786b42018-03-19 22:17:37 +053017 if len(item):
18 item = item[0]
19 if not item.action_document:
20 item.action_document = company
21 doc.save()
Prateeksha Singh242218d2017-09-13 18:41:01 +053022
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053023 # Initial state of slides
24 return [
25 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +053026 action_name='Add Company',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053027 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 Singh242218d2017-09-13 18:41:01 +053043 ),
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",
Zarrarbc551562018-02-21 11:13:14 +053051 "label":_("Monthly Sales Target (" + currency + ")"), "reqd":1},
Prateeksha Singh242218d2017-09-13 18:41:01 +053052 ],
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 Singh95d8fd32017-09-04 11:14:04 +053063 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +053064 action_name='Add Customers',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053065 domains=('Manufacturing', 'Services', 'Retail', 'Distribution'),
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053066 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 Shah8d9edbf2017-11-28 16:09:58 +053087
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 Singh95d8fd32017-09-04 11:14:04 +0530105 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +0530106 action_name='Add Suppliers',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530107 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 Singhada8ba92017-09-26 13:07:24 +0530135 action_name='Add Products',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530136 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 Solanki966f1412017-11-23 15:22:10 +0530164 # Education slides begin
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530165 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +0530166 action_name='Add Programs',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530167 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 Singhada8ba92017-09-26 13:07:24 +0530187 action_name='Add Courses',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530188 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 Singhada8ba92017-09-26 13:07:24 +0530207 action_name='Add Instructors',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530208 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 Singhada8ba92017-09-26 13:07:24 +0530227 action_name='Add Rooms',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530228 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 Solanki966f1412017-11-23 15:22:10 +0530243 # Education slides end
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530244
245 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +0530246 action_name='Add Users',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530247 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
274def get_user_progress_slides():
275 slides = []
276 slide_settings = get_slide_settings()
277
Prateeksha Singh73517092017-12-06 13:28:06 +0530278 domains = frappe.get_active_domains()
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530279 for s in slide_settings:
Prateeksha Singh73517092017-12-06 13:28:06 +0530280 if not s.domains or any(d in domains for d in s.domains):
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530281 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