Reflects this iteration's domain/feature changes across the docs set: - Cost centre = Vessel only (labelled 'Cost Centre'); costCentreRef/Site removed - Companies (multi-company invoicing) on POs and exports - 3-level 6-digit accounting-code hierarchy; leaf-only PO selection - Structured PO numbers COMPANY/VESSEL/ID/FY (ids from 9000) - Compulsory payment date; editable poDate; export date = approval date - Submitter vendor creation (unverified until proven); verifyVendor - Import PO -> CLOSED with auto vendor/product creation - Inventory flag; inventory added at approval; partial pay/receipt states - Microsoft Entra SSO (nullable passwordHash); profile reachable by all roles - README: roles, domain concepts, db:seed:prod, migrate-before-serve callout - CHANGELOG: Added/Changed/Fixed for the above Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4.2 KiB
4.2 KiB
Changelog
[Unreleased]
Added
- Companies (multi-company invoicing) — new
Companymodel and/admin/companiesCRUD. A PO is billed under a selected company (name, shortcode, GST number, address, phone/mobile, contact + invoice email, invoice address). The company's details populate the exported PO header / invoice block. - Structured PO numbers (
lib/po-number.ts) —COMPANY/VESSEL/ID/FY(e.g.PMS/HNR1/9000/2024-25); Indian financial year; system-generated IDs start at 9000. Imported POs keep their original number. - 3-level accounting-code hierarchy —
Account.parentIdself-relation (Top Category → Sub-Category → Leaf), 6-digit numeric codes seeded fromprisma/accounting-codes-data.ts. Only leaf codes are PO-selectable, via a searchable, portal-rendered combobox. - Compulsory payment date —
PurchaseOrder.paymentDatecaptured when Accounts records a payment; defaults to today, rejects future dates. Backfilled for existing POs frompaidAt/ the first payment action. - Editable PO date (
poDate) — the exported PO "Date" now showspoDate ?? approvedAt ?? createdAt(approval date once approved, not creation). - Submitter vendor creation —
create_vendorpermission lets Technical/Manning add vendors; they are created unverified and become verified when a PO closes/pays with them, on import, or via Manager/Accounts/Admin (verifyVendor). - Import PO → Closed —
/po/importsaves a parsed Excel PO directly asCLOSED, auto-detecting the company, matching the vessel by code, and auto-creating the vendor, products, and per-vendor prices. - Inventory feature flag (
NEXT_PUBLIC_INVENTORY_ENABLED) — site stock/consumption surfaces are gated; the vendor/item catalogue for PO creation stays available. Inventory is incremented at PO approval (not on close). - Dashboards — Accounts gains a "Payments Completed This Month" card.
- Automated issue-to-deploy pipeline — end-to-end flow from a user-reported bug to a production fix without manual intervention on the developer's part:
- Report Issue button (
App/components/layout/report-issue-button.tsx) — any signed-in user can file a bug from the portal header; the server action (report-issue-actions.ts) calls the Forgejo API and attachesportal+claude-queuelabels. - Claude issue watcher (
automation/claude-issue-watcher.ps1) — a Windows Scheduled Task (PelagiaClaudeIssueWatcher) polls Forgejo every 10 minutes, picks upclaude-queueissues, and runs Claude Code headlessly to implement and verify a fix. On success the watcher pushes aclaude/issue-Nbranch and opens a PR; on failure it posts a comment and labels the issueclaude-failed. - Tag-triggered deploy workflow (
.forgejo/workflows/deploy.yml) — pushing av*semver tag triggers thehostForgejo runner on pms1, which checks out the tag, runspnpm install, builds the app, applies Prisma migrations, and restarts the pm2 processppms.
- Report Issue button (
Changed
- Cost centre is now a Vessel only. The earlier Vessel-or-Site cost-centre model was removed:
PurchaseOrder.vesselIdis required, thecostCentreRefencoding is gone, andVesselno longer links to aSite. Vessels are surfaced as "Cost Centre" throughout the UI (/admin/vessels→ "Cost Centre Management"). - Closed Purchase Orders list: submitters see only their own
CLOSEDPOs; Managers/SuperUsers see allCLOSEDPOs. - Sidebar reorganised into Purchasing and Administration sections (role-aware); "Inventory" renamed to "Purchasing".
- Items:
/admin/productsis the editable catalogue;/inventory/itemsis read-only; both link to a shared item detail page. - Profile page is reachable by every role (incl. SSO-only / no-password users, with an email fallback lookup); only approvers can upload an approval signature.
- Manager dashboard "Approved This Month" now counts by
approvedAt(no longer undercounts once a PO progresses pastMGR_APPROVED).
Fixed
- Production
P2022 … column does not existafter deploy — caused by shipping code whose Prisma client expected a column beforemigrate deployhad run. Migrations must be applied before the new build serves traffic (now documented in the README).