drawings: on a rev mismatch, Clerical can keep the retired rev VISUAL calls (#41)
ci / server (pull_request) Failing after 17s
ci / frontend (pull_request) Successful in 42s
ci / image (pull_request) Skipped
ci / e2e (pull_request) Skipped

When VISUAL calls a rev that M-Files has retired, the draft is still
flagged rev_mismatch, but the drawing job now also copies the rev VISUAL
calls (MFilesKit 0.1.3 DrawingLookup.revision) into drawing_revisions and
visual.called. A Clerical Supervisor picks either rev on the packet:
"Use latest rev N" as before, or "Use rev V as VISUAL calls it"
(rev-approve with use=called), with a reason and a signature.

The kept rev holds while M-Files' Effective rev stays the one chosen
against: no flag, no change order. A newer Effective rev flags the
packet again; a new VISUAL rev clears the choice.

Migration 0009 adds drawing_revisions. Needs mfileskit 0.1.3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-19 13:39:14 -06:00
co-authored by Claude Opus 5.5
parent 4c0cba4da5
commit bb8eb17748
21 changed files with 547 additions and 55 deletions
+13 -1
View File
@@ -596,7 +596,18 @@ def drawings_state(n: int) -> dict[str, Any]:
raise ValueError("state is 1 or 2")
d: dict[str, Any] = {
"L900-0101": _dwg(1, "L900-0101 r1.pdf", n=1),
"L900-0201": _dwg(3, "L900-0201 r3.pdf", n=2), # VISUAL calls rev 2: rev mismatch
"L900-0201": { # VISUAL calls rev 2: rev mismatch. Rev 2 is Retired in M-Files.
**_dwg(3, "L900-0201 r3.pdf", n=2),
"revisions": {
"2": {
"file": "L900-0201 r2.pdf",
"status": "Retired",
"state": "Superseded",
"obj_id": 32,
"file_id": 132,
}
},
},
"L900-0401": _dwg(1, "L900-0401 r1.pdf", n=4), # VISUAL calls rev A: bad rev
"L900-0501": _dwg(
None, None, n=5, draft_rev=1, draft_where="in Drafting review", in_drafting=True, base="L900-05"
@@ -643,6 +654,7 @@ def generate(out_dir: Path | str, today: date | None = None) -> Path:
dwgs = drawings_state(n)
(out / f"drawings.{n}.json").write_text(json.dumps(dwgs, indent=1, ensure_ascii=False), encoding="utf-8")
files.update(v["file"] for v in dwgs.values() if v.get("file"))
files.update(r["file"] for v in dwgs.values() for r in (v.get("revisions") or {}).values() if r.get("file"))
for name in sorted(files):
(out / name).write_bytes(pdf_bytes(name))
write_state(out, 1)