blob: 685624e030f468925233968ecfd3e81652ffa3d8 [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()
10 domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
11 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")
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 Singh95d8fd32017-09-04 11:14:04 +053020 # Initial state of slides
21 return [
22 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +053023 action_name='Add Company',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053024 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 Singh242218d2017-09-13 18:41:01 +053040 ),
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 Singh95d8fd32017-09-04 11:14:04 +053060 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +053061 action_name='Add Customers',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053062 domains=('Manufacturing', 'Services', 'Retail', 'Distribution'),
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053063 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 ),
84 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +053085 action_name='Add Suppliers',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +053086 domains=('Manufacturing', 'Services', 'Retail', 'Distribution'),
87 icon="fa fa-group",
88 title=_("Your Suppliers"),
89 help=_("List a few of your suppliers. They could be organizations or individuals."),
90 fields=[
91 {"fieldtype":"Section Break"},
92 {"fieldtype":"Data", "fieldname":"supplier", "label":_("Supplier"),
93 "placeholder":_("Supplier Name")},
94 {"fieldtype":"Column Break"},
95 {"fieldtype":"Data", "fieldname":"supplier_contact",
96 "label":_("Contact Name"), "placeholder":_("Contact Name")},
97 ],
98 add_more=1, max_count=3, mandatory_entry=1,
99 submit_method="erpnext.utilities.user_progress_utils.create_suppliers",
100 done_state_title=_("Go to Suppliers"),
101 done_state_title_route=["List", "Supplier"],
102 help_links=[
103 {
104 "label": _('Learn More'),
105 "url": ["https://erpnext.org/docs/user/manual/en/buying/supplier"]
106 },
107 {
108 "label": _('Customers and Suppliers'),
109 "video_id": "zsrrVDk6VBs"
110 },
111 ]
112 ),
113 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +0530114 action_name='Add Products',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530115 domains=['Manufacturing', 'Services', 'Retail', 'Distribution'],
116 icon="fa fa-barcode",
117 title=_("Your Products or Services"),
118 help=_("List your products or services that you buy or sell."),
119 fields=[
120 {"fieldtype":"Section Break", "show_section_border": 1},
121 {"fieldtype":"Data", "fieldname":"item", "label":_("Item"),
122 "placeholder":_("A Product")},
123 {"fieldtype":"Column Break"},
124 {"fieldtype":"Select", "fieldname":"item_uom", "label":_("UOM"),
125 "options":[_("Unit"), _("Nos"), _("Box"), _("Pair"), _("Kg"), _("Set"),
126 _("Hour"), _("Minute"), _("Litre"), _("Meter"), _("Gram")],
127 "default": _("Unit"), "static": 1},
128 {"fieldtype":"Column Break"},
129 {"fieldtype":"Currency", "fieldname":"item_price", "label":_("Rate"), "static": 1}
130 ],
131 add_more=1, max_count=3, mandatory_entry=1,
132 submit_method="erpnext.utilities.user_progress_utils.create_items",
133 done_state_title=_("Go to Items"),
134 done_state_title_route=["List", "Item"],
135 help_links=[
136 {
137 "label": _("Explore Sales Cycle"),
138 "video_id": "1eP90MWoDQM"
139 },
140 ]
141 ),
142
Manas Solanki966f1412017-11-23 15:22:10 +0530143 # Education slides begin
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530144 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +0530145 action_name='Add Programs',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530146 domains=("Education"),
147 title=_("Program"),
148 help=_("Example: Masters in Computer Science"),
149 fields=[
150 {"fieldtype":"Section Break", "show_section_border": 1},
151 {"fieldtype":"Data", "fieldname":"program", "label":_("Program"), "placeholder": _("Program Name")},
152 ],
153 add_more=1, max_count=3, mandatory_entry=1,
154 submit_method="erpnext.utilities.user_progress_utils.create_program",
155 done_state_title=_("Go to Programs"),
156 done_state_title_route=["List", "Program"],
157 help_links=[
158 {
159 "label": _("Student Application"),
160 "video_id": "l8PUACusN3E"
161 },
162 ]
163
164 ),
165 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +0530166 action_name='Add Courses',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530167 domains=["Education"],
168 title=_("Course"),
169 help=_("Example: Basic Mathematics"),
170 fields=[
171 {"fieldtype":"Section Break", "show_section_border": 1},
172 {"fieldtype":"Data", "fieldname":"course", "label":_("Course"), "placeholder": _("Course Name")},
173 ],
174 add_more=1, max_count=3, mandatory_entry=1,
175 submit_method="erpnext.utilities.user_progress_utils.create_course",
176 done_state_title=_("Go to Courses"),
177 done_state_title_route=["List", "Course"],
178 help_links=[
179 {
180 "label": _('Add Students'),
181 "route": ["List", "Student"]
182 }
183 ]
184 ),
185 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +0530186 action_name='Add Instructors',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530187 domains=["Education"],
188 title=_("Instructor"),
189 help=_("People who teach at your organisation"),
190 fields=[
191 {"fieldtype":"Section Break", "show_section_border": 1},
192 {"fieldtype":"Data", "fieldname":"instructor", "label":_("Instructor"), "placeholder": _("Instructor Name")},
193 ],
194 add_more=1, max_count=3, mandatory_entry=1,
195 submit_method="erpnext.utilities.user_progress_utils.create_instructor",
196 done_state_title=_("Go to Instructors"),
197 done_state_title_route=["List", "Instructor"],
198 help_links=[
199 {
200 "label": _('Student Batches'),
201 "route": ["List", "Student Batch"]
202 }
203 ]
204 ),
205 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +0530206 action_name='Add Rooms',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530207 domains=["Education"],
208 title=_("Room"),
209 help=_("Classrooms/ Laboratories etc where lectures can be scheduled."),
210 fields=[
211 {"fieldtype":"Section Break", "show_section_border": 1},
212 {"fieldtype":"Data", "fieldname":"room", "label":_("Room")},
213 {"fieldtype":"Column Break"},
214 {"fieldtype":"Int", "fieldname":"room_capacity", "label":_("Room Capacity"), "static": 1},
215 ],
216 add_more=1, max_count=3, mandatory_entry=1,
217 submit_method="erpnext.utilities.user_progress_utils.create_room",
218 done_state_title=_("Go to Rooms"),
219 done_state_title_route=["List", "Room"],
220 help_links=[]
221 ),
Manas Solanki966f1412017-11-23 15:22:10 +0530222 # Education slides end
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530223
224 frappe._dict(
Prateeksha Singhada8ba92017-09-26 13:07:24 +0530225 action_name='Add Users',
Prateeksha Singh95d8fd32017-09-04 11:14:04 +0530226 title=_("Add Users"),
227 help=_("Add users to your organization, other than yourself."),
228 fields=[
229 {"fieldtype":"Section Break"},
230 {"fieldtype":"Data", "fieldname":"user_email", "label":_("Email ID"),
231 "placeholder":_("user@example.com"), "options": "Email", "static": 1},
232 {"fieldtype":"Column Break"},
233 {"fieldtype":"Data", "fieldname":"user_fullname",
234 "label":_("Full Name"), "static": 1},
235 ],
236 add_more=1, max_count=3, mandatory_entry=1,
237 submit_method="erpnext.utilities.user_progress_utils.create_users",
238 done_state_title=_("Go to Users"),
239 done_state_title_route=["List", "User"],
240 help_links=[
241 {
242 "label": _('Learn More'),
243 "url": ["https://erpnext.org/docs/user/manual/en/setting-up/users-and-permissions"]
244 },
245 {
246 "label": _('Users and Permissions'),
247 "video_id": "8Slw1hsTmUI"
248 },
249 ]
250 )
251 ]
252
253def get_user_progress_slides():
254 slides = []
255 slide_settings = get_slide_settings()
256
257 domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
258
259 for s in slide_settings:
260 if not s.domains or (domain and domain in s.domains):
261 s.mark_as_done_method = "erpnext.setup.doctype.setup_progress.setup_progress.set_action_completed_state"
262 s.done = get_action_completed_state(s.action_name) or 0
263 slides.append(s)
264
265 return slides
266