chore: add after_migrate hook to persist Desktop Icon, fix status field
This commit is contained in:
parent
6c7402da0c
commit
598e5f695b
5 changed files with 45 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# Service Factory — ERPNext Custom App Project
|
# Service Factory — ERPNext Custom App Project
|
||||||
|
|
||||||
> **Current Version: V0.1.0011** — Each completed prompt/step increments the patch number by 1 (V0.1.0000 → V0.1.0001 → V0.1.0002…). The agent automatically commits and pushes after every step.
|
> **Current Version: V0.1.0012** — Each completed prompt/step increments the patch number by 1 (V0.1.0000 → V0.1.0001 → V0.1.0002…). The agent automatically commits and pushes after every step.
|
||||||
|
|
||||||
## Project Overview
|
## Project Overview
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,31 @@
|
||||||
# Copyright (c) 2026, cclohmar and contributors
|
# Copyright (c) 2026, cclohmar and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
|
||||||
def has_app_permission():
|
def has_app_permission():
|
||||||
"""Check if the current user has permission to see the Service Factory app icon."""
|
"""Check if the current user has permission to see the Service Factory app icon."""
|
||||||
import frappe
|
|
||||||
|
|
||||||
if frappe.session.user == "Guest":
|
if frappe.session.user == "Guest":
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def create_desktop_icon():
|
||||||
|
"""Ensure the Service Factory Desktop Icon exists after migrate."""
|
||||||
|
if frappe.db.exists("Desktop Icon", {"app": "service_factory"}):
|
||||||
|
return
|
||||||
|
|
||||||
|
icon = frappe.new_doc("Desktop Icon")
|
||||||
|
icon.label = "Service Factory"
|
||||||
|
icon.app = "service_factory"
|
||||||
|
icon.icon_type = "App"
|
||||||
|
icon.link = "/app/engagement-board"
|
||||||
|
icon.logo_url = "/assets/service_factory/icons/service_factory.svg"
|
||||||
|
icon.standard = 1
|
||||||
|
icon.hidden = 0
|
||||||
|
icon.idx = 50
|
||||||
|
icon.save(ignore_permissions=True)
|
||||||
|
frappe.db.commit()
|
||||||
|
print("✅ Service Factory Desktop Icon created (after_migrate)")
|
||||||
|
|
|
||||||
14
service_factory/service_factory/fixtures/desktop_icon.json
Normal file
14
service_factory/service_factory/fixtures/desktop_icon.json
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Service Factory",
|
||||||
|
"label": "Service Factory",
|
||||||
|
"app": "service_factory",
|
||||||
|
"icon_type": "App",
|
||||||
|
"link": "/app/engagement-board",
|
||||||
|
"logo_url": "/assets/service_factory/icons/service_factory.svg",
|
||||||
|
"standard": 1,
|
||||||
|
"hidden": 0,
|
||||||
|
"idx": 50,
|
||||||
|
"doctype": "Desktop Icon"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
@ -175,6 +175,12 @@ fixtures = [
|
||||||
{"dt": "Engagement Task Type"},
|
{"dt": "Engagement Task Type"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Recreate Service Factory Desktop Icon after each migrate
|
||||||
|
# (Frappe's orphan cleanup removes it before fixtures run)
|
||||||
|
after_migrate = [
|
||||||
|
"service_factory.api.permission.create_desktop_icon"
|
||||||
|
]
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
# -------
|
# -------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"naming_series",
|
"naming_series",
|
||||||
"card_type",
|
"card_type",
|
||||||
|
"status",
|
||||||
"task",
|
"task",
|
||||||
"title",
|
"title",
|
||||||
"column_break_1",
|
"column_break_1",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue