Skip to content

Commit c822460

Browse files
authored
Merge pull request #26 from reapbenefit/feat/microskill
feat: Microskill
2 parents e3c1197 + 014cb1b commit c822460

File tree

7 files changed

+323
-8
lines changed

7 files changed

+323
-8
lines changed

samaaja/samaaja/custom/energy_point_log.json

Lines changed: 189 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,188 @@
11
{
22
"custom_fields": [
3+
{
4+
"_assign": null,
5+
"_comments": null,
6+
"_liked_by": null,
7+
"_user_tags": null,
8+
"allow_in_quick_entry": 0,
9+
"allow_on_submit": 0,
10+
"bold": 0,
11+
"collapsible": 0,
12+
"collapsible_depends_on": null,
13+
"columns": 0,
14+
"creation": "2025-09-17 13:37:17.350209",
15+
"default": null,
16+
"depends_on": null,
17+
"description": null,
18+
"docstatus": 0,
19+
"dt": "Energy Point Log",
20+
"fetch_from": null,
21+
"fetch_if_empty": 0,
22+
"fieldname": "microskill",
23+
"fieldtype": "Link",
24+
"hidden": 0,
25+
"hide_border": 0,
26+
"hide_days": 0,
27+
"hide_seconds": 0,
28+
"idx": 13,
29+
"ignore_user_permissions": 0,
30+
"ignore_xss_filter": 0,
31+
"in_global_search": 0,
32+
"in_list_view": 0,
33+
"in_preview": 0,
34+
"in_standard_filter": 0,
35+
"insert_after": "badge",
36+
"is_system_generated": 0,
37+
"is_virtual": 0,
38+
"label": "Microskill",
39+
"length": 0,
40+
"mandatory_depends_on": null,
41+
"modified": "2025-09-17 13:37:42.748947",
42+
"modified_by": "Administrator",
43+
"module": null,
44+
"name": "Energy Point Log-custom_microskill",
45+
"no_copy": 0,
46+
"non_negative": 0,
47+
"options": "Microskill",
48+
"owner": "Administrator",
49+
"permlevel": 0,
50+
"precision": "",
51+
"print_hide": 0,
52+
"print_hide_if_no_value": 0,
53+
"print_width": null,
54+
"read_only": 0,
55+
"read_only_depends_on": null,
56+
"report_hide": 0,
57+
"reqd": 0,
58+
"search_index": 0,
59+
"sort_options": 0,
60+
"translatable": 0,
61+
"unique": 0,
62+
"width": null
63+
},
64+
{
65+
"_assign": null,
66+
"_comments": null,
67+
"_liked_by": null,
68+
"_user_tags": null,
69+
"allow_in_quick_entry": 0,
70+
"allow_on_submit": 0,
71+
"bold": 0,
72+
"collapsible": 0,
73+
"collapsible_depends_on": null,
74+
"columns": 0,
75+
"creation": "2025-09-17 00:54:11.630635",
76+
"default": null,
77+
"depends_on": null,
78+
"description": null,
79+
"docstatus": 0,
80+
"dt": "Energy Point Log",
81+
"fetch_from": null,
82+
"fetch_if_empty": 0,
83+
"fieldname": "custom_column_break_q7iti",
84+
"fieldtype": "Column Break",
85+
"hidden": 0,
86+
"hide_border": 0,
87+
"hide_days": 0,
88+
"hide_seconds": 0,
89+
"idx": 14,
90+
"ignore_user_permissions": 0,
91+
"ignore_xss_filter": 0,
92+
"in_global_search": 0,
93+
"in_list_view": 0,
94+
"in_preview": 0,
95+
"in_standard_filter": 0,
96+
"insert_after": "microskill",
97+
"is_system_generated": 0,
98+
"is_virtual": 0,
99+
"label": null,
100+
"length": 0,
101+
"mandatory_depends_on": null,
102+
"modified": "2025-09-17 13:37:42.759456",
103+
"modified_by": "Administrator",
104+
"module": null,
105+
"name": "Energy Point Log-custom_column_break_q7iti",
106+
"no_copy": 0,
107+
"non_negative": 0,
108+
"options": null,
109+
"owner": "hello@anupamvs.dev",
110+
"permlevel": 0,
111+
"precision": "",
112+
"print_hide": 0,
113+
"print_hide_if_no_value": 0,
114+
"print_width": null,
115+
"read_only": 0,
116+
"read_only_depends_on": null,
117+
"report_hide": 0,
118+
"reqd": 0,
119+
"search_index": 0,
120+
"sort_options": 0,
121+
"translatable": 0,
122+
"unique": 0,
123+
"width": null
124+
},
125+
{
126+
"_assign": null,
127+
"_comments": null,
128+
"_liked_by": null,
129+
"_user_tags": null,
130+
"allow_in_quick_entry": 0,
131+
"allow_on_submit": 0,
132+
"bold": 0,
133+
"collapsible": 0,
134+
"collapsible_depends_on": null,
135+
"columns": 0,
136+
"creation": "2025-09-17 00:54:11.218754",
137+
"default": null,
138+
"depends_on": null,
139+
"description": null,
140+
"docstatus": 0,
141+
"dt": "Energy Point Log",
142+
"fetch_from": null,
143+
"fetch_if_empty": 0,
144+
"fieldname": "skill_section",
145+
"fieldtype": "Section Break",
146+
"hidden": 0,
147+
"hide_border": 0,
148+
"hide_days": 0,
149+
"hide_seconds": 0,
150+
"idx": 12,
151+
"ignore_user_permissions": 0,
152+
"ignore_xss_filter": 0,
153+
"in_global_search": 0,
154+
"in_list_view": 0,
155+
"in_preview": 0,
156+
"in_standard_filter": 0,
157+
"insert_after": "seen",
158+
"is_system_generated": 0,
159+
"is_virtual": 0,
160+
"label": "Skill",
161+
"length": 0,
162+
"mandatory_depends_on": null,
163+
"modified": "2025-09-17 13:38:01.674586",
164+
"modified_by": "Administrator",
165+
"module": null,
166+
"name": "Energy Point Log-custom_skill",
167+
"no_copy": 0,
168+
"non_negative": 0,
169+
"options": null,
170+
"owner": "hello@anupamvs.dev",
171+
"permlevel": 0,
172+
"precision": "",
173+
"print_hide": 0,
174+
"print_hide_if_no_value": 0,
175+
"print_width": null,
176+
"read_only": 0,
177+
"read_only_depends_on": null,
178+
"report_hide": 0,
179+
"reqd": 0,
180+
"search_index": 0,
181+
"sort_options": 0,
182+
"translatable": 0,
183+
"unique": 0,
184+
"width": null
185+
},
3186
{
4187
"_assign": null,
5188
"_comments": null,
@@ -25,20 +208,20 @@
25208
"hide_border": 0,
26209
"hide_days": 0,
27210
"hide_seconds": 0,
28-
"idx": 8,
211+
"idx": 13,
29212
"ignore_user_permissions": 0,
30213
"ignore_xss_filter": 0,
31214
"in_global_search": 0,
32215
"in_list_view": 0,
33216
"in_preview": 0,
34217
"in_standard_filter": 0,
35-
"insert_after": "reference_name",
218+
"insert_after": "skill_section",
36219
"is_system_generated": 0,
37220
"is_virtual": 0,
38221
"label": "Badge",
39222
"length": 0,
40223
"mandatory_depends_on": null,
41-
"modified": "2025-03-18 20:17:56.365417",
224+
"modified": "2025-09-17 13:38:01.795052",
42225
"modified_by": "Administrator",
43226
"module": null,
44227
"name": "Energy Point Log-badge",
@@ -71,23 +254,23 @@
71254
"_comments": null,
72255
"_liked_by": null,
73256
"_user_tags": null,
74-
"creation": "2025-03-18 23:20:21.301022",
257+
"creation": "2025-09-17 13:37:17.149971",
75258
"default_value": null,
76259
"doc_type": "Energy Point Log",
77260
"docstatus": 0,
78261
"doctype_or_field": "DocType",
79262
"field_name": null,
80263
"idx": 0,
81264
"is_system_generated": 0,
82-
"modified": "2025-03-18 23:20:21.301022",
265+
"modified": "2025-09-17 13:37:17.149971",
83266
"modified_by": "Administrator",
84267
"module": null,
85268
"name": "Energy Point Log-main-field_order",
86269
"owner": "Administrator",
87270
"property": "field_order",
88271
"property_type": "Data",
89272
"row_name": null,
90-
"value": "[\"user\", \"type\", \"points\", \"rule\", \"column_break_5\", \"reference_doctype\", \"reference_name\", \"badge\", \"reverted\", \"revert_of\", \"section_break_10\", \"reason\", \"seen\"]"
273+
"value": "[\"user\", \"type\", \"points\", \"rule\", \"column_break_5\", \"reference_doctype\", \"reference_name\", \"reverted\", \"revert_of\", \"section_break_10\", \"seen\", \"custom_skill\", \"badge\", null, \"custom_column_break_q7iti\", \"reason\"]"
91274
}
92275
],
93276
"sync_on_migrate": 1

samaaja/samaaja/doctype/badge/badge.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,13 @@
5151
}
5252
],
5353
"index_web_pages_for_search": 1,
54-
"links": [],
55-
"modified": "2023-04-09 19:52:24.564252",
54+
"links": [
55+
{
56+
"link_doctype": "Microskill",
57+
"link_fieldname": "badge"
58+
}
59+
],
60+
"modified": "2025-09-17 13:31:01.063750",
5661
"modified_by": "Administrator",
5762
"module": "Samaaja",
5863
"name": "Badge",

samaaja/samaaja/doctype/microskill/__init__.py

Whitespace-only changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright (c) 2025, FOSS United and contributors
2+
// For license information, please see license.txt
3+
4+
frappe.ui.form.on('Microskill', {
5+
// refresh: function(frm) {
6+
7+
// }
8+
});
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"actions": [],
3+
"allow_rename": 1,
4+
"creation": "2025-09-17 13:08:05.336181",
5+
"default_view": "List",
6+
"doctype": "DocType",
7+
"editable_grid": 1,
8+
"engine": "InnoDB",
9+
"field_order": [
10+
"title",
11+
"description",
12+
"column_break_ola2a",
13+
"active",
14+
"level",
15+
"badge"
16+
],
17+
"fields": [
18+
{
19+
"fieldname": "title",
20+
"fieldtype": "Data",
21+
"in_list_view": 1,
22+
"label": "Title",
23+
"reqd": 1
24+
},
25+
{
26+
"fieldname": "description",
27+
"fieldtype": "Small Text",
28+
"label": "Description",
29+
"reqd": 1
30+
},
31+
{
32+
"default": "1",
33+
"fieldname": "active",
34+
"fieldtype": "Check",
35+
"in_list_view": 1,
36+
"label": "Active"
37+
},
38+
{
39+
"fieldname": "level",
40+
"fieldtype": "Select",
41+
"in_list_view": 1,
42+
"label": "Level",
43+
"options": "\nL1\nL2\nL3\nL4\nL5",
44+
"reqd": 1
45+
},
46+
{
47+
"fieldname": "badge",
48+
"fieldtype": "Link",
49+
"in_list_view": 1,
50+
"in_standard_filter": 1,
51+
"label": "Badge",
52+
"options": "Badge",
53+
"reqd": 1
54+
},
55+
{
56+
"fieldname": "column_break_ola2a",
57+
"fieldtype": "Column Break"
58+
}
59+
],
60+
"index_web_pages_for_search": 1,
61+
"links": [],
62+
"modified": "2025-09-17 13:48:10.169264",
63+
"modified_by": "Administrator",
64+
"module": "Samaaja",
65+
"name": "Microskill",
66+
"owner": "Administrator",
67+
"permissions": [
68+
{
69+
"create": 1,
70+
"delete": 1,
71+
"email": 1,
72+
"export": 1,
73+
"print": 1,
74+
"read": 1,
75+
"report": 1,
76+
"role": "System Manager",
77+
"share": 1,
78+
"write": 1
79+
}
80+
],
81+
"show_title_field_in_link": 1,
82+
"sort_field": "modified",
83+
"sort_order": "DESC",
84+
"states": [],
85+
"title_field": "title"
86+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright (c) 2025, FOSS United and contributors
2+
# For license information, please see license.txt
3+
4+
import frappe
5+
from frappe.model.document import Document
6+
7+
class Microskill(Document):
8+
def validate(self):
9+
if self.level and self.badge:
10+
exists = frappe.db.exists(
11+
"Microskill",
12+
{
13+
"level": self.level,
14+
"badge": self.badge,
15+
"name": ["!=", self.name]
16+
}
17+
)
18+
if exists:
19+
frappe.throw(f"A Microskill with Level {self.level} and Badge {self.badge} already exists.")
20+
21+
def after_doctype_update():
22+
"""Ensure composite unique key on (level, badge)."""
23+
# Create/replace index on DB level
24+
frappe.db.add_index("Microskill", ["level", "badge"], index_name="unique_level_badge", unique=True)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2025, FOSS United and Contributors
2+
# See license.txt
3+
4+
# import frappe
5+
from frappe.tests.utils import FrappeTestCase
6+
7+
8+
class TestMicroskill(FrappeTestCase):
9+
pass

0 commit comments

Comments
 (0)