workspace: fold invoice_az e-taxes doctypes into Taxes Az

Adds three new cards (E-Taxes Setup, Reference, Documents) under a
"E-Taxes & ƏMAS" header so Asan Login, E-Taxes Settings, and the rest
of the standalone invoice_az doctypes are reachable from the Taxes Az
workspace and sidebar.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ali 2026-05-04 16:18:32 +00:00
parent f9c89eecec
commit 0753a36275
2 changed files with 64 additions and 5 deletions

View File

@ -40,8 +40,8 @@ Goal: make blocked modules invisible and unreachable for every user, including A
Idempotent setup run via `after_migrate`.
- Builds a `Workspace` named **Taxes Az** with three cards (Declarations, Setup, Tools), a `Workspace Sidebar` listing every taxes_az doctype, and a `Desktop Icon` that routes via the sidebar.
- The doctype list is a **static snapshot** in `DECLARATIONS_DOCTYPES` / `SETUP_DOCTYPES` / `TOOLS_DOCTYPES`. Adding a DocType to the `taxes_az` app does NOT auto-include it — append to the tuple and re-migrate.
- Builds a `Workspace` named **Taxes Az** with six cards (Declarations, Setup, Tools, E-Taxes Setup, E-Taxes Reference, E-Taxes Documents), a `Workspace Sidebar` listing every doctype, and a `Desktop Icon` that routes via the sidebar.
- The doctype list is a **static snapshot** in `DECLARATIONS_DOCTYPES` / `SETUP_DOCTYPES` / `TOOLS_DOCTYPES` (taxes_az) and `ETAXES_SETUP_DOCTYPES` / `ETAXES_REFERENCE_DOCTYPES` / `ETAXES_DOCUMENT_DOCTYPES` (invoice_az). Adding a DocType to either app does NOT auto-include it — append to the tuple and re-migrate.
- `_cleanup_obsolete()` removes legacy docs owned by this app (currently `"Taxes"`). Only touches records where `app == "jey_theme"` — never deletes ERPNext/other-app docs.
### Frontend: multi-theme system

View File

@ -20,6 +20,9 @@ DESKTOP_ICON_IDX = 999
CARD_DECLARATIONS = "Declarations & Returns"
CARD_SETUP = "Setup & Reference"
CARD_TOOLS = "Period Closing & Tools"
CARD_ETAXES_SETUP = "E-Taxes Setup"
CARD_ETAXES_REFERENCE = "E-Taxes Reference"
CARD_ETAXES_DOCUMENTS = "E-Taxes Documents"
# Obsolete docs we created under the old "Taxes" name; cleaned up on setup
# (only if they're owned by jey_theme — we never touch erpnext's own docs).
@ -72,9 +75,48 @@ TOOLS_DOCTYPES: tuple[str, ...] = (
"Tax Year Closing Wizard",
)
# --- invoice_az doctypes that have no parent subsystem ------------------
# Top-level (non-child-table) invoice_az doctypes folded into Taxes Az.
ETAXES_SETUP_DOCTYPES: tuple[str, ...] = (
"Asan Login",
"E-Taxes Settings",
"E-Taxes Bank Account",
"E-Taxes Cash Register",
"E-Taxes POS Terminal",
"E-Taxes Presented Certificate",
)
ETAXES_REFERENCE_DOCTYPES: tuple[str, ...] = (
"E-Taxes Customers",
"E-Taxes Suppliers",
"E-Taxes Parties",
"E-Taxes Item",
"E-Taxes Item Group",
"E-Taxes Unit",
"E-Taxes Object",
"E-Taxes Obligation Pact",
"Amas Employees",
)
ETAXES_DOCUMENT_DOCTYPES: tuple[str, ...] = (
"E-Taxes Purchase",
"E-Taxes Purchase Outbox",
"E-Taxes Sales",
"E-Taxes Sales Outbox",
"E-Taxes VAT Operations",
)
def _all_doctypes() -> list[str]:
return list(DECLARATIONS_DOCTYPES) + list(SETUP_DOCTYPES) + list(TOOLS_DOCTYPES)
return (
list(DECLARATIONS_DOCTYPES)
+ list(SETUP_DOCTYPES)
+ list(TOOLS_DOCTYPES)
+ list(ETAXES_SETUP_DOCTYPES)
+ list(ETAXES_REFERENCE_DOCTYPES)
+ list(ETAXES_DOCUMENT_DOCTYPES)
)
def _link_row(label: str) -> dict:
@ -108,6 +150,9 @@ def _build_links() -> list[dict]:
(CARD_DECLARATIONS, DECLARATIONS_DOCTYPES),
(CARD_SETUP, SETUP_DOCTYPES),
(CARD_TOOLS, TOOLS_DOCTYPES),
(CARD_ETAXES_SETUP, ETAXES_SETUP_DOCTYPES),
(CARD_ETAXES_REFERENCE, ETAXES_REFERENCE_DOCTYPES),
(CARD_ETAXES_DOCUMENTS, ETAXES_DOCUMENT_DOCTYPES),
):
links.append(_card_break(card_label, len(items)))
for dt in items:
@ -125,6 +170,14 @@ def _build_content() -> str:
"data": {"card_name": CARD_SETUP, "col": 6}},
{"id": "jeyTxC3", "type": "card",
"data": {"card_name": CARD_TOOLS, "col": 6}},
{"id": "jeyTxH2", "type": "header",
"data": {"text": "<span class=\"h4\"><b>E-Taxes & ƏMAS</b></span>", "col": 12}},
{"id": "jeyTxC4", "type": "card",
"data": {"card_name": CARD_ETAXES_SETUP, "col": 6}},
{"id": "jeyTxC5", "type": "card",
"data": {"card_name": CARD_ETAXES_REFERENCE, "col": 6}},
{"id": "jeyTxC6", "type": "card",
"data": {"card_name": CARD_ETAXES_DOCUMENTS, "col": 12}},
])
@ -160,7 +213,10 @@ def ensure_workspace() -> str:
return (f"updated {WORKSPACE_NAME} "
f"(decl={len(DECLARATIONS_DOCTYPES)} "
f"setup={len(SETUP_DOCTYPES)} "
f"tools={len(TOOLS_DOCTYPES)})")
f"tools={len(TOOLS_DOCTYPES)} "
f"etx_setup={len(ETAXES_SETUP_DOCTYPES)} "
f"etx_ref={len(ETAXES_REFERENCE_DOCTYPES)} "
f"etx_docs={len(ETAXES_DOCUMENT_DOCTYPES)})")
ws = frappe.get_doc({
"doctype": "Workspace",
@ -180,7 +236,10 @@ def ensure_workspace() -> str:
return (f"created {WORKSPACE_NAME} "
f"(decl={len(DECLARATIONS_DOCTYPES)} "
f"setup={len(SETUP_DOCTYPES)} "
f"tools={len(TOOLS_DOCTYPES)})")
f"tools={len(TOOLS_DOCTYPES)} "
f"etx_setup={len(ETAXES_SETUP_DOCTYPES)} "
f"etx_ref={len(ETAXES_REFERENCE_DOCTYPES)} "
f"etx_docs={len(ETAXES_DOCUMENT_DOCTYPES)})")
def _build_sidebar_items() -> list[dict]: