chore: add after_migrate hook to persist Desktop Icon, fix status field

This commit is contained in:
root 2026-07-16 10:09:55 +00:00
parent 6c7402da0c
commit 598e5f695b
5 changed files with 45 additions and 5 deletions

View file

@ -1,6 +1,6 @@
# 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

View file

@ -1,12 +1,31 @@
# Copyright (c) 2026, cclohmar and contributors
# For license information, please see license.txt
import frappe
def has_app_permission():
"""Check if the current user has permission to see the Service Factory app icon."""
import frappe
if frappe.session.user == "Guest":
return False
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)")

View 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"
}
]

View file

@ -175,6 +175,12 @@ fixtures = [
{"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
# -------

View file

@ -13,8 +13,9 @@
"engine": "InnoDB",
"field_order": [
"naming_series",
"card_type",
"task",
"card_type",
"status",
"task",
"title",
"column_break_1",
"priority",