Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 189 additions & 6 deletions samaaja/samaaja/custom/energy_point_log.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,188 @@
{
"custom_fields": [
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"creation": "2025-09-17 13:37:17.350209",
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"dt": "Energy Point Log",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "microskill",
"fieldtype": "Link",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"idx": 13,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "badge",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Microskill",
"length": 0,
"mandatory_depends_on": null,
"modified": "2025-09-17 13:37:42.748947",
"modified_by": "Administrator",
"module": null,
"name": "Energy Point Log-custom_microskill",
"no_copy": 0,
"non_negative": 0,
"options": "Microskill",
"owner": "Administrator",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"sort_options": 0,
"translatable": 0,
"unique": 0,
"width": null
},
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"creation": "2025-09-17 00:54:11.630635",
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"dt": "Energy Point Log",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "custom_column_break_q7iti",
"fieldtype": "Column Break",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"idx": 14,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "microskill",
"is_system_generated": 0,
"is_virtual": 0,
"label": null,
"length": 0,
"mandatory_depends_on": null,
"modified": "2025-09-17 13:37:42.759456",
"modified_by": "Administrator",
"module": null,
"name": "Energy Point Log-custom_column_break_q7iti",
"no_copy": 0,
"non_negative": 0,
"options": null,
"owner": "hello@anupamvs.dev",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"sort_options": 0,
"translatable": 0,
"unique": 0,
"width": null
},
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"creation": "2025-09-17 00:54:11.218754",
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"dt": "Energy Point Log",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "skill_section",
"fieldtype": "Section Break",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"idx": 12,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "seen",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Skill",
"length": 0,
"mandatory_depends_on": null,
"modified": "2025-09-17 13:38:01.674586",
"modified_by": "Administrator",
"module": null,
"name": "Energy Point Log-custom_skill",
"no_copy": 0,
"non_negative": 0,
"options": null,
"owner": "hello@anupamvs.dev",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"sort_options": 0,
"translatable": 0,
"unique": 0,
"width": null
},
{
"_assign": null,
"_comments": null,
Expand All @@ -25,20 +208,20 @@
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"idx": 8,
"idx": 13,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "reference_name",
"insert_after": "skill_section",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Badge",
"length": 0,
"mandatory_depends_on": null,
"modified": "2025-03-18 20:17:56.365417",
"modified": "2025-09-17 13:38:01.795052",
"modified_by": "Administrator",
"module": null,
"name": "Energy Point Log-badge",
Expand Down Expand Up @@ -71,23 +254,23 @@
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"creation": "2025-03-18 23:20:21.301022",
"creation": "2025-09-17 13:37:17.149971",
"default_value": null,
"doc_type": "Energy Point Log",
"docstatus": 0,
"doctype_or_field": "DocType",
"field_name": null,
"idx": 0,
"is_system_generated": 0,
"modified": "2025-03-18 23:20:21.301022",
"modified": "2025-09-17 13:37:17.149971",
"modified_by": "Administrator",
"module": null,
"name": "Energy Point Log-main-field_order",
"owner": "Administrator",
"property": "field_order",
"property_type": "Data",
"row_name": null,
"value": "[\"user\", \"type\", \"points\", \"rule\", \"column_break_5\", \"reference_doctype\", \"reference_name\", \"badge\", \"reverted\", \"revert_of\", \"section_break_10\", \"reason\", \"seen\"]"
"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\"]"
}
],
"sync_on_migrate": 1
Expand Down
9 changes: 7 additions & 2 deletions samaaja/samaaja/doctype/badge/badge.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-04-09 19:52:24.564252",
"links": [
{
"link_doctype": "Microskill",
"link_fieldname": "badge"
}
],
"modified": "2025-09-17 13:31:01.063750",
"modified_by": "Administrator",
"module": "Samaaja",
"name": "Badge",
Expand Down
Empty file.
8 changes: 8 additions & 0 deletions samaaja/samaaja/doctype/microskill/microskill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2025, FOSS United and contributors
// For license information, please see license.txt

frappe.ui.form.on('Microskill', {
// refresh: function(frm) {

// }
});
86 changes: 86 additions & 0 deletions samaaja/samaaja/doctype/microskill/microskill.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2025-09-17 13:08:05.336181",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"title",
"description",
"column_break_ola2a",
"active",
"level",
"badge"
],
"fields": [
{
"fieldname": "title",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Title",
"reqd": 1
},
{
"fieldname": "description",
"fieldtype": "Small Text",
"label": "Description",
"reqd": 1
},
{
"default": "1",
"fieldname": "active",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Active"
},
{
"fieldname": "level",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Level",
"options": "\nL1\nL2\nL3\nL4\nL5",
"reqd": 1
},
{
"fieldname": "badge",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Badge",
"options": "Badge",
"reqd": 1
},
{
"fieldname": "column_break_ola2a",
"fieldtype": "Column Break"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2025-09-17 13:48:10.169264",
"modified_by": "Administrator",
"module": "Samaaja",
"name": "Microskill",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"show_title_field_in_link": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"title_field": "title"
}
24 changes: 24 additions & 0 deletions samaaja/samaaja/doctype/microskill/microskill.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (c) 2025, FOSS United and contributors
# For license information, please see license.txt

import frappe
from frappe.model.document import Document

class Microskill(Document):
def validate(self):
if self.level and self.badge:
exists = frappe.db.exists(
"Microskill",
{
"level": self.level,
"badge": self.badge,
"name": ["!=", self.name]
}
)
if exists:
frappe.throw(f"A Microskill with Level {self.level} and Badge {self.badge} already exists.")

def after_doctype_update():
"""Ensure composite unique key on (level, badge)."""
# Create/replace index on DB level
frappe.db.add_index("Microskill", ["level", "badge"], index_name="unique_level_badge", unique=True)
9 changes: 9 additions & 0 deletions samaaja/samaaja/doctype/microskill/test_microskill.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2025, FOSS United and Contributors
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase


class TestMicroskill(FrappeTestCase):
pass
Loading