[DTP-Worker] Sprint 6 · Générateur Chat OTOIA embarqué par portail (Custom Block natif) (ERPNext Backend · roadmap L63)
CI / Contraintes NON-NÉGOCIABLES (CLAUDE.md) (push) Has been cancelled
CI / Validation JSON (schémas Faisabilité) (push) Has been cancelled
CI / Qualité documentaire (liens + 4Big) (push) Has been cancelled
CI / Publiciste · parser + schéma + generator (unittest) (push) Has been cancelled
CI / RBAC · 50 rôles + schéma (unittest) (push) Has been cancelled
CI / Faisabilité · générateur 4 volets + round-trip (unittest) (push) Has been cancelled
CI / RBAC · fixtures ERPNext (Role + Custom DocPerm) (push) Has been cancelled
CI / RBAC · plan User Permission (row-level) (push) Has been cancelled
CI / RBAC · Role Profile (bundles par portail) (push) Has been cancelled
CI / RBAC · run-book d'application unifié (agrégat 3 volets) (push) Has been cancelled
CI / Faisabilité · dossier bancable trilingue FR/EN/ES (push) Has been cancelled
CI / CRM · workflow vente ERPNext (lead → CONFOTUR) (push) Has been cancelled
CI / CRM · DocType porteur OTO Dossier Vente (push) Has been cancelled
CI / CRM · barème commissions vendeurs (push) Has been cancelled
CI / Fiscal · e-CF DGII (Compupar) (push) Has been cancelled
CI / Frontend · Workspaces 5 portails rôle (push) Has been cancelled
CI / Legal · DocType CONFOTUR Application (push) Has been cancelled
CI / QA · Audit 5D conformité (push) Has been cancelled
CI / SEO · mots-clés trilingues + schema.org + hreflang (push) Has been cancelled
CI / Chat OTOIA · montage par portail (Custom Block) (push) Has been cancelled
CI / E2E baseline Playwright (manuel) (push) Has been cancelled
CI / Gate qualité (agrégat) (push) Has been cancelled
CI / Contraintes NON-NÉGOCIABLES (CLAUDE.md) (push) Has been cancelled
CI / Validation JSON (schémas Faisabilité) (push) Has been cancelled
CI / Qualité documentaire (liens + 4Big) (push) Has been cancelled
CI / Publiciste · parser + schéma + generator (unittest) (push) Has been cancelled
CI / RBAC · 50 rôles + schéma (unittest) (push) Has been cancelled
CI / Faisabilité · générateur 4 volets + round-trip (unittest) (push) Has been cancelled
CI / RBAC · fixtures ERPNext (Role + Custom DocPerm) (push) Has been cancelled
CI / RBAC · plan User Permission (row-level) (push) Has been cancelled
CI / RBAC · Role Profile (bundles par portail) (push) Has been cancelled
CI / RBAC · run-book d'application unifié (agrégat 3 volets) (push) Has been cancelled
CI / Faisabilité · dossier bancable trilingue FR/EN/ES (push) Has been cancelled
CI / CRM · workflow vente ERPNext (lead → CONFOTUR) (push) Has been cancelled
CI / CRM · DocType porteur OTO Dossier Vente (push) Has been cancelled
CI / CRM · barème commissions vendeurs (push) Has been cancelled
CI / Fiscal · e-CF DGII (Compupar) (push) Has been cancelled
CI / Frontend · Workspaces 5 portails rôle (push) Has been cancelled
CI / Legal · DocType CONFOTUR Application (push) Has been cancelled
CI / QA · Audit 5D conformité (push) Has been cancelled
CI / SEO · mots-clés trilingues + schema.org + hreflang (push) Has been cancelled
CI / Chat OTOIA · montage par portail (Custom Block) (push) Has been cancelled
CI / E2E baseline Playwright (manuel) (push) Has been cancelled
CI / Gate qualité (agrégat) (push) Has been cancelled
Carrier natif ERPNext v15 (Custom Block) + config runtime par portail. Ancrage RBAC : roles_allowed/knowledge_scope = surface exacte du portail, synchronisés avec les Has Role des Workspaces. Endpoint OTOIA null (a_confirmer). Persona Amélie + capabilities + langues FR/EN/ES sourcés (anti-invention #6). 14 invariants · 31 tests · régression 408 tests verts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
"""Modèle Frappe/ERPNext v15 : DocType natif `Custom Block` (carrier du Chat OTOIA).
|
||||
|
||||
Pourquoi un `Custom Block` (et pas un widget externe)
|
||||
-----------------------------------------------------
|
||||
La roadmap Sprint 6 demande « Chat OTOIA embedded dans CHAQUE portail ».
|
||||
Contrainte #1 « ERPNext natif = priorité absolue avant tout outil externe » : dans
|
||||
ERPNext v15, un bloc de contenu réutilisable inséré dans un `Workspace` EST le
|
||||
DocType `Custom Block` (`frappe/desk/doctype/custom_block`). Le desk référence un
|
||||
Custom Block depuis le `content` (editor.js) d'un Workspace via un bloc de type
|
||||
`custom_block`. On produit donc un `Custom Block` par portail — aucun framework de
|
||||
chat externe côté worker.
|
||||
|
||||
Champs `Custom Block` utilisés (v15) :
|
||||
- `block_name` (Data, unique, requis) : identifiant lisible du bloc.
|
||||
- `html` (HTML) : le markup rendu. Ici, UNIQUEMENT un `<div>` de montage
|
||||
vide et déterministe (id dérivé de la clé du portail). Le web-component OTOIA
|
||||
réel et son JS sont chargés par le thème desk (VPS · agent Frontend · #8) ;
|
||||
le worker ne fabrique aucun script ni endpoint.
|
||||
|
||||
Anti-invention (#6) : ce module ne connaît AUCUN portail ni rôle en dur, n'émet
|
||||
aucun chiffre et aucune URL. Le `<div>` de montage porte la clé du portail et la
|
||||
persona (sourcée CLAUDE.md) — rien d'autre. La config runtime (rôles autorisés,
|
||||
portée de connaissance, endpoint) vit dans `chat_mount.json`, pas dans le HTML.
|
||||
|
||||
Ce module ne touche JAMAIS le VPS : il retourne des dicts sérialisables.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
CUSTOM_BLOCK_DOCTYPE = "Custom Block"
|
||||
|
||||
# Type de bloc editor.js référençant un Custom Block dans le `content` d'un
|
||||
# Workspace (v15). Fourni au hand-off VPS ; la clé exacte de payload editor.js
|
||||
# peut varier selon le patch de version → marquée `a_confirmer` dans le manifeste.
|
||||
WORKSPACE_CONTENT_BLOCK_TYPE = "custom_block"
|
||||
|
||||
|
||||
def mount_html(html_id: str, portail_key: str, persona: str, css_class: str) -> str:
|
||||
"""`<div>` de montage vide, déterministe (aucun chiffre, aucune URL)."""
|
||||
return (
|
||||
f'<div class="{css_class}" id="{html_id}" '
|
||||
f'data-portail="{portail_key}" data-assistant="{persona}"></div>'
|
||||
)
|
||||
|
||||
|
||||
def custom_block_fixture(block_name: str, html: str) -> dict[str, Any]:
|
||||
"""Fixture `Custom Block` importable (bench). Champs standard posés par Frappe
|
||||
à l'import (name/owner/idx) volontairement non fabriqués."""
|
||||
return {
|
||||
"doctype": CUSTOM_BLOCK_DOCTYPE,
|
||||
"block_name": block_name,
|
||||
"html": html,
|
||||
}
|
||||
Reference in New Issue
Block a user