RBT Group Enhancements: Summary and Tasks
· VG Support
Summary
RBT wants every uploaded invoice and delivery receipt (DR) reviewed by a person, tagged to a branch, kept for audit, and exported through a simpler Export page. The meeting's notes fall into eight workstreams. Two wait on inputs from RBT: the GL account list and a Dropbox account.
| # | Workstream | What it delivers | Status |
|---|---|---|---|
| A | Review and Document Lifecycle | Review and approve DRs and invoices; reject, archive, return for re-upload; no deleting what was processed or exported | Ready |
| B | Branches | Branch management, users in one or more branches, branch picked on upload, lists scoped by branch | Ready |
| C | Upload Pages and Permissions | Separate Invoice Upload and DR Upload pages with their own permissions and upload history | Ready |
| D | New Supplier Detection | Suppliers found on extracted invoices added to the list, with who, which branch and a note | Ready |
| E | Raw File Naming and BIR Export | Raw files saved under a document number and date name, and downloadable for BIR audits | Ready |
| F | Page Enhancements | Invoices, Export and Generate, Delivery Receipts, and the Settings section rename | Ready |
| G | GL Accounts | GL account dropdown on suppliers | On hold: waiting for RBT's list |
| H | RBT Dropbox | Dropbox account connected for RBT | On hold |
All work happens in rbtgroup/veritrust-rbtgroup, on branches cut from origin/main. Anything that isn't RBT-specific should go to upstream veritrust-einvoice first.
Progress
Steps 1 to 4 (Invoices part) are merged on both repos, and every production deploy succeeded on both instances: Settings and Branches (#3, #19), Upload Pages and the Invoices table (#5, #21), and the nginx fix (#4, #20), plus the certbot PR #2. The nginx config still has to be applied by hand on each server. The Delivery Receipts table is built on feat/dr-table and in review as PR #6 on rbtgroup and PR #22 on Veritrust-Global. Last updated 2026-12-02.
| Step | Status | Where | Notes |
|---|---|---|---|
| 1. Settings Rename | Done | 9818a46 and 743bff1 on feat/rbt-enhancements | pnpm verify passed; code review clean. Review follow-ups done in 743bff1 (stop notice test, one doc sentence); 630 frontend tests pass |
| 2. Branches (B) | Done | 7265256 to cdf2ccd on feat/rbt-enhancements | Built and security reviewed; review fixes done (only Owners grant Manage Branches, replacing a file keeps its branch). Audit Log and the Dashboard's Recent Activity now open only for people who see every branch. Verify passed: 1019 backend, 660 frontend, 169 worker tests. Later: tag audit entries with a branch. Duplicate messages across branches accepted as a design choice |
| 3. Upload Pages and Permissions (C) | Done | feat/upload-pages: #5 and #21 | Built: Invoice Upload and DR Upload pages with upload history, Upload Invoices permission (given to every role that could upload before), who uploaded each invoice now recorded. Verify passed: 1043 backend, 680 frontend, 169 worker tests. Independent security review: no findings. To confirm: Delivery Receipts no longer opens for upload-only users. Decided 2026-12-03: uploaders see each upload's status, with a notice when one failed, and can retry a failed upload. Viewers who can't upload see statuses, failed ones included, only with a new View Upload Status permission (no retry). Built as uploads.view_status (Owner and Administrator by default): retry for failed uploads, failure reason, a failed-uploads notice, 3 retries per file. Drive files retryable too. Migration 0035_grant-uploads-view-status. Merged as PR #14 (rbtgroup) and PR #30 (Veritrust-Global) and deployed on both instances. Decided 2026-12-03: failed Dropbox DR files should show in DR Upload history. Done: every drive DR file (Dropbox or Google Drive, failed and refused ones included) shows there for people who see every branch, with a drive filter. Merged as PR #12 (rbtgroup) and PR #28 (Veritrust-Global) and deployed on both instances |
| 4. Invoices and Delivery Receipts Tables (F) | Done | feat/upload-pages: #5 and #21 | Invoices table built: rename, Dropbox card removed, All and Rejected tabs, server-side search, filters (branch, source, dates, status, detections), sorting and 25-row paging, shared table pattern. Code and security reviews done; their fixes are in. Rejected lists discarded invoices until step 5. Delivery Receipts table built on feat/dr-table (ce7074e to e9c1cf1): For Review and Reviewed tabs in one table, server-side search, filters, sorting and paging, Reading and action columns moved to a details panel and row menu; verify passed (1115 backend, 717 frontend); security review clean, code review fixes in. Merged as PR #6 (rbtgroup) and PR #22 (Veritrust-Global) and deployed on both instances. nginx fix done (logs paths without search text): PR #4 on rbtgroup (stacked on deploy PR #2) and PR #20 on Veritrust-Global; applied and verified on the old shared instance on 2026-12-03. Not applied on the rbtgroup instance: its config serves einvoice.rbtgroup.link directly, and that domain's registration failed in Route 53, so it waits on the domain |
| 5. Review and Lifecycle (A) | Done | feat/review-lifecycle (762517f to 1ad371d), migration 0030 | Built: Reject (with reason), Return for Re-upload (with reason), Archive and Unarchive for rejected items, Approve for receipts, read-only detail and status history for any invoice or receipt, and no deleting anything processed, approved, exported, used or replaced. Verify passed: 1200 backend, 752 frontend. Independent security review: safe to ship; its four low findings fixed, and merged with the raw file export (migrations 0030 and 0031). Merged as PR #8 (rbtgroup) and PR #24 (Veritrust-Global). Deployed on the rbtgroup instance. Deployed on the old shared instance after PR #25 (Veritrust-Global) fixed the unordered audit queries in the drive tests; the same settings test fix went to rbtgroup as PR #9. Not built yet: un-rejecting a receipt |
| 6. New Supplier Detection (D) | Done | Built (64ab5c8 to 7550a8a, migration 0032). A supplier is new when no supplier has its TIN (or its name, without a TIN). New Supplier warning on Extraction Review and in the Invoices list, worked out on the server too. New Suppliers tab on Suppliers: name, TIN, document count, first and latest document, who uploaded, branch; Add as Supplier, Link to Existing Supplier, Dismiss. Dashboard tile. Confirmed 2026-12-03: suppliers stay shared across branches, so a link or dismissal applies to every branch. Follow-up done: optional Added from Branch on each supplier, with when and by whom (Added From column on Suppliers), defaulted from the document when added from New Suppliers; migration 0034_supplier_origin. Merged as PR #13 (rbtgroup) and PR #29 (Veritrust-Global) and deployed on both instances. Verify passed. Independent security review: safe to ship; two low findings fixed in 2b00a3b. Merged as PR #10 (rbtgroup) and PR #26 (Veritrust-Global). Deployed on both instances | |
| 7. Export and Generate Export (F) | Done | Built (43ac915 to 143f0a8, migration 0033). Exports page: table of generated files with search, branch, type, status and date filters, Ready or Downloaded status, and a download per row. Generate Export page: type (invoices, DRs or both), branch and date range, lists the To Be Exported records it takes, preview, then Export back to Exports; Raw Files is an option there. Old /export redirects. Verify passed. Independent security review: safe to ship; its low finding fixed in f174739. Rebuilt on top of step 6 (migration 0033 after 0032, checked on a fresh database); Generate Export also marks new suppliers. Merged as PR #11 (rbtgroup) and PR #27 (Veritrust-Global) and deployed on both instances. Merged after step 6 so the migrations run in order | |
| 8. Raw File Naming and BIR Export (E) | Done | feat/raw-file-names (27bf7ec, 18e4619) | Built. Stored keys stay random; downloads are named INV_<TIN>_<invoice no>_<date> and DR_<branch>_<DR no>_<date> once reviewed, INV_UNREAD_… before. Raw Files dialog on the export page: a zip plus index.csv by type, branch and date range, for people who can export and see every branch; capped at 2,000 files or 500 MB, 20 a hour, audited. Independent security review: safe to ship; its two low findings fixed in b079eae. Merged as PR #7 (rbtgroup) and PR #23 (Veritrust-Global) and deployed on both instances |
| 9. GL Accounts and RBT Dropbox (G, H) | On Hold | GL Accounts built (migrations 0036, 0037; manual add, import, Not in GL List flag), merged as PR #18 (rbtgroup) and PR #34 (Veritrust-Global) and deployed on both instances (2026-12-03); upload RBT's chart of accounts on Settings > GL Accounts: RBT's Peachtree chart of accounts received; GL Accounts page under Settings imports it, and suppliers pick their GL account from the list. RBT Dropbox still waiting on RBT. rbtgroup.link domain skipped for now | |
| 10. Custom Roles | Done | feat/custom-roles | Requested 2026-12-03: admins create, rename and delete their own roles and pick each one's permissions. Owner stays built-in with every permission; Maker, Checker and Administrator stay built-in. No one can grant more than they hold. Merged as PR #17 (rbtgroup) and PR #33 (Veritrust-Global) and deployed on both instances; migration 0038_roles. Change: Administrators can no longer grant permissions they don't hold themselves; only an Owner can |
| 11. Deactivation Warnings | Done | feat/deactivation-warnings | Requested 2026-12-03. Nothing can be deleted, only deactivated, and neither check had warnings. Adds warnings (not blocks): deactivating a branch shows its active users, who has no other branch, and unfinished items; deactivating a user names branches where they are the last active member. The server requires a confirm when there are warnings. Merged as PR #16 (rbtgroup) and PR #32 (Veritrust-Global) and deployed on both instances. Follow-up fixed: Owners and anyone with Manage Branches are no longer counted as stranded, and the last-member warning says when only they remain. Merged as PR #22 (rbtgroup) and PR #38 (Veritrust-Global) and deployed on both instances |
| 12. Supplier Duplicates | Done | feat/supplier-duplicates | Decided 2026-12-03: check duplicates by name and by name + TIN. Same name and same 9-digit TIN (branch code ignored) = same supplier. Name match alone = Possible Match hint, with Link to Existing preselected. New Supplier rows for one supplier merged. Warning before adding a near-duplicate; Possible Duplicates filter on Suppliers. Suggestions only, no auto-merge. Merged as PR #20 (rbtgroup) and PR #35 (Veritrust-Global) and deployed on both instances; no migration. Checks stay fast with 2,000 suppliers and 10,000 documents (under 150 ms) |
| 13. Dashboard Focus | In Progress | feat/dashboard-focus | Requested 2026-12-03: Dashboard cut down to invoices and DRs. Work Queue tiles per type (For Review, Returned, To Be Exported, failed) linking to filtered lists, plus New Suppliers; Invoices and Delivery Receipts sections side by side; Recent Exports. Extraction section and approval-only tiles removed |
| 14. DR File Preview | Done | feat/dr-file-preview | Requested 2026-12-03: opening a delivery receipt shows its file (image or PDF) side by side with the details, instead of opening it in a new tab. Stacked on narrow screens; Open in New Tab kept as a fallback. Done: shared file viewer (also used by Extraction Review) with zoom, fit and rotate for images and inline PDFs; no header or nginx change needed. Merged as PR #23 (rbtgroup) and PR #39 (Veritrust-Global) and deployed on both instances. Note: each opening now records File Viewed in the Audit Log |
A. Review, Approval and Document Lifecycle
Every uploaded invoice and DR goes through Review, then Approved, and can be rejected, archived or returned for re-upload, but never deleted once processed or exported. Today invoices have review, returned, approved (shown as To Be Exported), exported and discarded. DRs only have For Review and a reviewed stamp.
Agree one status set for both invoices and DRs: For Review, Approved, Returned, Rejected, Archived, Exported
Give DRs the same states as invoices (schema change and migration through the
db-changeskill), keeping today's reviewed DRs as ApprovedApprove step for DRs and invoices, with its own permission so uploaders and approvers can be different people
Detail view for any extracted invoice or DR, exported or not: the file next to its extracted fields, its status history and its export batch
Read-only detail once exported; a recheck can only add a note or open a correction, not change the exported figures
Reject: needs a reason, moves the item to Rejected, recorded in the Audit Log
Archive: hides rejected or discarded items from the main lists, with an Archived filter to see them again
Return for Re-upload: a Returned status with a reason, shown to the uploader, who replaces the file (reuses
PUT /api/documents/:id/file; DRs need the same)Block deletion on the server for anything processed or exported; only an unprocessed or failed upload can be deleted, and the delete button hides otherwise
Tests for every allowed and refused state change, in both apps
B. Branches
Branches become a real record: each user belongs to one or more branches, and each upload is tagged with one of them. Nothing in the app knows about branches today.
branchestable (name, code, active) and auser_branchesjoin table, so a user can be in several branchesbranch_idon documents and DR files, required on new uploads; decide what existing records get (an "Unassigned" branch, or one RBT names)Branch Management page under Settings: add, rename, deactivate branches, and see or change each branch's users
Branch column and multi-select on Users and Roles, so a user's branches can be set when they are created
Branch picker on both upload pages, listing only the uploader's branches, and preselected when they have one
Server check that the chosen branch is one of the uploader's; Owners and admins can upload for any branch
Scope lists by branch: users see their branches' records, Owners and admins see all
Branch shown on list rows, the detail view and in the Audit Log
New permission
branches.manage(both permission catalogs plus the granting migration, through theadd-permissionskill)Tests for branch scoping on every list and for refusing an upload to a branch the user isn't in
C. Upload Pages and Permissions
Uploading moves to two pages of its own, Invoice Upload and DR Upload, each with its own permission and an upload history. Today invoices upload from the Inbox card, and DRs from the Delivery Receipts page with delivery_receipts.upload.
New permission
invoices.upload, and keepdelivery_receipts.uploadfor DRs, so a person can upload one type without seeing the otherInvoice Upload page (
/invoices/upload): branch picker, drop zone, and a Recent Uploads table (file, branch, uploaded by, date, status)DR Upload page (
/delivery-receipts/upload), the same layout, replacing the Recent Files card on Delivery ReceiptsHistory scope: uploaders see their own uploads in their branches; Owners and admins see everyone's
Both pages in
PAGE_ACCESS, the router and the sidebar, hidden withuseCanOpen(through theadd-pageskill)The Upload button on Invoices and Delivery Receipts opens these pages, and shows only with the upload permission
Server checks
invoices.uploadonPOST /api/documents, keeping the per-person rate limitTests for page access, history scope and refused uploads
D. New Supplier Detection
When an extracted invoice's supplier isn't on the list, the app adds it as Pending, with a note saying who uploaded it and from which branch. Suppliers already have a pending status and match by TIN digits.
On extraction, match the supplier by TIN, then by name; with no match, create a Pending supplier from the extracted name, TIN and address
New columns on suppliers:
source(manual or detected),detected_by,detected_branch_id,detected_document_idandnotesDo it on the server, inside the transaction that saves the result, with an Audit Log entry; never from the worker, which only writes the job result
Don't create the same supplier twice when several invoices from one new supplier arrive together (unique TIN digits, insert-or-skip)
A New badge and a Detected filter on Suppliers, linking to the invoice it came from
Verifying a detected supplier clears the badge; rejecting marks it inactive
Tests for matching, the race between two invoices, and the audit entry
E. Raw File Naming and BIR Export
Raw files keep their random storage key, and the readable name is worked out from the document's number and date, for downloads and the BIR export. Today both invoices and DRs are saved as <random uuid>.<ext>. Building the stored key from extracted text would break the rule against storage paths from document data, and the number is only known after extraction.
Naming format, for example
INV_<supplier TIN>_<invoice no>_<YYYY-MM-DD>.pdfandDR_<branch code>_<DR no>_<YYYY-MM-DD>.pdf, with a fallback when no number was readA
downloadNameworked out on the server from reviewed fields, stripped to safe characters and kept shortUse it as the file name for single downloads (
Content-Disposition), and as the S3 object's download nameRaw File Export for Owners and admins: pick type, branch and date range, get a zip with each file under its download name and an index CSV
Build the zip in the worker as a new job type (through the
add-job-typeskill) if it gets large; show its progress on the Export pageClash handling when two files would get the same name (add
_2)Tests for name building, odd characters and duplicates
F. Page Enhancements
Four pages get simpler, filterable tables, and the admin section is renamed. Filtering, sorting and paging should run on the server, so the lists stay fast as uploads grow.
Shared Table Pattern
One list API pattern:
?q=&branch=&source=&status=&detected=&from=&to=&sort=&page=&pageSize=, returning rows and a totalOne reusable toolbar and table (search, dropdown filters, multi-select, date range, sortable headers, pagination), used by every page below
Filters kept in the URL, so a filtered view can be shared or refreshed
Invoices (Today: Invoice Inbox)
Rename to Invoices in the sidebar, page title and docs
Remove the Dropbox card and the Manual Upload card; add an Upload button that opens Invoice Upload
Tabs cut to All and Rejected
Search, filters (branch, source, date uploaded, status, detections as a multi-select), sorting and pagination
Export (Today: To Be Exported)
Rename to Export; the page becomes a table of exported files (name, type, branch, date range, items, created by, created at, status, download), with filters, sorting and pagination
Generate button opens a new Generate Export page
Generate Export: filters for branch (All by default), type (Invoices or Delivery Receipts) and date range; Load shows the matching Approved items
Two table layouts on Generate Export, one for invoices and one for DRs
Export button creates the file and returns to Export, where its status shows (Generating, Ready, Failed)
Decide whether the export stays on the current sheet template flow (
POST /api/export-files/sheet) or a new per-type file, and whether it runs in the workerExported items move to Exported, inside the same transaction as the file and its audit entry
Delivery Receipts
Upload button opens DR Upload; the Recent Files card moves there
Same search, filters, sorting and pagination as Invoices
Move the Reading column and the last column out of the table, into the detail view or a row menu, to give the table room
Suppliers
No change now, apart from the New badge and filter from workstream D; GL Accounts later (workstream G)
Settings Section
Rename the Administration sidebar section to Settings
Rename today's Settings page to Integration (keep the old
/settingslink redirecting there)Branch Management sits in this section
Update
docs/design/page docs, the page tracker and the roadmap with each change
G. GL Accounts (On Hold)
Waiting for RBT's GL account list file. Suppliers already have a free-text gl_account column, so this replaces it with a pick from a managed list.
gl_accountstable (code, name, active), loaded from RBT's file through a seed or an importGL Account dropdown on the supplier form and a column on the Suppliers table
Move existing free-text values to the matching account, and list the ones that don't match
Decide whether the GL account goes into the export file
H. RBT Dropbox (On Hold)
On hold until RBT confirms the account. Uploads from Invoices no longer show the Dropbox card, but drive pickup keeps working from Integration.
Create RBT's Dropbox app and put its keys in SSM (the
einvoice-integrations-setupskill)Decide which branch files picked up from Dropbox belong to (one folder per branch, or a default branch)
Suggested Order of Work
Branches come first, because uploads, lists, exports and supplier notes all need a branch. Each step is its own pull request.
Settings rename (Administration to Settings, Settings to Integration): small, and clears the way for Branch Management
Branches: tables, Branch Management, users in branches, branch on documents and DRs (B)
Upload pages and permissions, with the branch picker and upload history (C)
Shared table pattern, then Invoices and Delivery Receipts on it (F)
Review and lifecycle: one status set, DR approval, reject, archive, return, no delete after processing (A)
New supplier detection (D)
Export and Generate Export (F)
Raw file naming and the BIR raw file export (E)
GL Accounts and RBT Dropbox, once their inputs arrive (G, H)
Open Questions
Which branches exist, and which branch do existing invoices, DRs and users go to?
Who approves: the same role for invoices and DRs, and can the uploader approve their own upload?
Is Archived only for rejected items, or can approved items be archived too?
Exact file name format RBT wants for BIR: which fields, and what date (document date or upload date)?
Should a detected supplier need someone to verify it before its invoices can be approved?
Does Export keep RBT's Google Sheet template layout, or switch to a plain file per type?
Which roles count as "admin" for seeing every branch: Owner only, or a new Manager role too?
Should these changes also go to upstream
veritrust-einvoicefor other clients, or stay in this fork?