Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix(accounting): block the cutover only on jobs that took cost before L (#1891)
Brad Barbin895dfc7d88b7
diff --git a/.ai/specs/implemented/2026-10-08-accounting-cutover.md b/.ai/specs/implemented/2026-10-08-accounting-cutover.mdindex eea8d563dc..cfcf5b0ee8 100644--- a/.ai/specs/implemented/2026-10-08-accounting-cutover.md+++ b/.ai/specs/implemented/2026-10-08-accounting-cutover.md@@ -117,7 +117,7 @@ Route `/x/accounting/activation`, linked from Settings → Accounting and from t- `fiscalYearSettings` exists. Base currency is set.- D is the first day of a calendar month (a period). D is not after today in the company time zone. D is at most 3 periods before the current period (`CUTOVER_MAX_PERIODS_BACK`).- No Draft or Pending receipt, shipment, sales invoice or purchase invoice, and no Draft payment or memo, is dated before D.- - No job created before L is still open. L is the `createdAt` of the company's first Provisional or Superseded journal. If the company has none, L is now, and every open job blocks.+ - No open job took cost before L: no `Job Consumption` or `Job Receipt` item ledger row, production event or production quantity of the job was created before L. L is the `createdAt` of the company's first Provisional or Superseded journal. If the company has none, L is now. Such activity wrote no journal, so the job's WIP lines are short of its cost. A job with no activity before L (a Draft, Planned or Ready job) has nothing missing and does not block.- No Posted journal with `sourceType 'Opening Balance'` exists. The unique index `journal_one_posted_opening_balance_per_company` allows one, and the enable writes it.A failed check returns reason codes, and the wizard translates them.@@ -474,7 +474,7 @@ Each ticked criterion names the test that proves it. Each open criterion says wh- [x] **Q1. Does this spec replace the July cutover spec?** — **Answer:** Yes, completely. It carries over the one-way enable, the configuration locks, the flag retirement and the new-company path. The July spec moves to `archived/`.- [x] **Q2. Does the full sub-ledger path run for every company?** — **Answer:** Yes. The flag decides only the journal status. Every company writes cost layers, finished-goods and asset cost, deferral schedules and intercompany rows. The revenue recognition cron gets a cutover check.- [x] **Q3. What happens to Mark Paid?** — **Answer:** Remove it. Users record payments through Payments.-- [x] **Q4. How are documents posted before always-posting treated?** — **Answer:** The cutover derives every opening amount from the documents, the same way for every company. There is no baseline and no history replay. The enable resets inventory to on-hand × a reviewed unit cost. The one legacy rule: the wizard refuses the cutover while a job that was open at L is still open.+- [x] **Q4. How are documents posted before always-posting treated?** — **Answer:** The cutover derives every opening amount from the documents, the same way for every company. There is no baseline and no history replay. The enable resets inventory to on-hand × a reviewed unit cost. The one legacy rule: the wizard refuses the cutover while an open job took cost before L.- [x] **Q5. Can the cutover date D be in the past?** — **Answer:** Yes. The inventory reset applies as of D. The enable re-costs the movements between D and the enable against the reset layers. It posts each cost difference as a Provisional journal before promotion (section 5, step 3).- [x] **Q6. What happens to Provisional journals dated before D?** — **Answer:** They keep a terminal status, `Superseded`. They are immutable. The journal list hides them unless a status filter asks for them. The filter shows the status as "Before cutover".- [x] **Q7. Does a posting fail if its Provisional journal cannot be built?** — **Answer (revised 2026-10-08):** No back-fill. Account numbers and names are user-editable, so a back-fill by number can point a default at an unrelated account. Before cutover, an empty default with no fallback becomes a stand-in line on Retained Earnings that records the default it wanted (`journalLine.accountDefaultRole`). The readiness step requires each such default, and the enable re-points the stand-in lines before promotion. After cutover, the empty default fails the posting. (Revised again on 2026-10-09: a default with a fallback uses the fallback in both states, section 1 item 5.)@@ -511,3 +511,4 @@ Each ticked criterion names the test that proves it. Each open criterion says wh- 2026-10-09: Review fixes, the wizard and the accounting module (f1fe2b6c81). `hasAccountingCutover` is the one cutover test in the ERP. The routes import the reads from `@carbon/database/accounting-cutover-reads`. The trial balance CSV import is a tested pure parser that refuses an ambiguous amount. The server computes the inventory totals. A cost is read-only without `update: parts`.- 2026-10-09: Review fixes, the status check and the last gaps (188a710e24). `journal-status-filter` checks one statement at a time and sees qualified, aliased and raw SQL status filters. Every journal that the backfill or the repair writes stays out of provider sync. Settings finds legacy documents with one `EXISTS` query, and readiness returns reason codes. An outbound adjustment writes its journal pair at zero cost too.- 2026-10-09: The spec follows HEAD. Section 5 gets step 10a. Sections 3, 4, 5a, 6, 7, the APIs, the UI and the Risks follow the code. Each ticked Acceptance Criterion names the test that proves it.+- 2026-10-09: The legacy-jobs check blocks only an open job that took cost before L (an item ledger row, production event or production quantity created before L), not every open job created before L. A Draft or Planned job blocked the cutover with nothing missing from its WIP.diff --git a/apps/erp/app/modules/accounting/ui/Activation/ReadinessChecklist.tsx b/apps/erp/app/modules/accounting/ui/Activation/ReadinessChecklist.tsxindex 840d92de1a..6d7a001af6 100644--- a/apps/erp/app/modules/accounting/ui/Activation/ReadinessChecklist.tsx+++ b/apps/erp/app/modules/accounting/ui/Activation/ReadinessChecklist.tsx@@ -198,7 +198,7 @@ function ReadinessCheckRow({case "pending-documents":return t`No unposted documents dated before the cutover`;case "legacy-jobs":- return t`No open jobs from before Carbon recorded their costs`;+ return t`No open jobs with costs from before Carbon recorded them`;case "opening-balance":return t`No posted opening balance`;}@@ -316,9 +316,9 @@ function useCheckDetail(check: ActivationCheck): string | null {})}`;case "legacy-jobs":return t`${plural(check.count, {- one: "Complete or cancel the # job created before Carbon recorded its costs.",+ one: "Complete or cancel the # job that took costs before Carbon recorded them.",other:- "Complete or cancel the # jobs created before Carbon recorded their costs."+ "Complete or cancel the # jobs that took costs before Carbon recorded them."})}`;case "opening-balance":return t`The company already has a posted opening balance journal.`;diff --git a/docs/content/docs/reference/accounting.mdx b/docs/content/docs/reference/accounting.mdxindex e4ae5d15cc..e4aa96acf3 100644--- a/docs/content/docs/reference/accounting.mdx+++ b/docs/content/docs/reference/accounting.mdx@@ -75,7 +75,7 @@ Setting up accounting opens your books in Carbon at a **cutover date**. Carbon t- **Fiscal year and base currency are set.**- **The cutover date is valid**: the first day of a period, not after today, and at most 3 periods before the current one.- **No unposted documents dated before the cutover**: no receipt, shipment or invoice that is Draft or Pending, and no Draft payment or memo. Post or delete them.-- **No open jobs from before Carbon recorded their costs.** Complete or cancel them.+- **No open jobs with costs from before Carbon recorded them**: no open job had material issued, output completed, time or quantities reported before Carbon started recording costs. Complete or cancel them. A Draft, Planned or Ready job with no such activity does not block.- **No posted opening balance**: the company has no Posted Opening Balance journal.</Step><Step>diff --git a/packages/database/src/accounting-cutover/readiness.ts b/packages/database/src/accounting-cutover/readiness.tsindex f4c2423c5b..c542f34446 100644--- a/packages/database/src/accounting-cutover/readiness.ts+++ b/packages/database/src/accounting-cutover/readiness.ts@@ -233,11 +233,11 @@ export async function getActivationReadiness(const legacyJobsCheck: ActivationCheck = {key: "legacy-jobs",- label: "No open jobs from before Carbon recorded their costs",+ label: "No open jobs with costs from before Carbon recorded them",passed: legacyJobs.count === 0,detail:legacyJobs.count > 0- ? `Complete or cancel ${legacyJobs.count} job(s) created before Carbon recorded their costs.`+ ? `Complete or cancel ${legacyJobs.count} job(s) that took costs before Carbon recorded them.`: null,reasons: [],items: legacyJobs.items,@@ -411,35 +411,87 @@ async function getPendingDocumentsBeforeCutover(const CLOSED_JOB_STATUSES = ["Completed", "Cancelled", "Closed"] as const;/**- * Open jobs created before L, the creation time of the company's first- * Provisional or Superseded journal (now when it has none). Carbon did not- * record the cost of such a job from its start.+ * Open jobs that took cost before L, the creation time of the company's first+ * Provisional or Superseded journal (now when it has none). A material issue,+ * a completion, a time entry or a reported quantity before L wrote no journal,+ * so the job's WIP lines are short of its cost, and `close-job` would relieve+ * WIP that was never debited. A job with no such activity, a Draft or Planned+ * job for example, has nothing missing: every cost it takes from now on posts.*/async function getLegacyOpenJobs(db: CutoverDb,companyId: string): Promise<{ items: ActivationCheckItem[]; count: number }> {- const firstPreCutoverJournal = db+ const legacyCutoff = sql<string>`coalesce(${db.selectFrom("journal").select((eb) => eb.fn.min("createdAt").as("createdAt")).where("companyId", "=", companyId)- .where("status", "in", [...PRE_CUTOVER_JOURNAL_STATUSES]);+ .where("status", "in", [...PRE_CUTOVER_JOURNAL_STATUSES])}, now())`;const rows = await db.selectFrom("job").select([- "id",- "jobId as readableId",- "status",+ "job.id",+ "job.jobId as readableId",+ "job.status",sql<number>`count(*) over ()`.as("total")])- .where("companyId", "=", companyId)- .where("status", "not in", [...CLOSED_JOB_STATUSES])- .where(- "createdAt",- "<",- sql<string>`coalesce(${firstPreCutoverJournal}, now())`+ .where("job.companyId", "=", companyId)+ .where("job.status", "not in", [...CLOSED_JOB_STATUSES])+ .where((eb) =>+ eb.or([+ eb.exists(+ eb+ .selectFrom("itemLedger")+ .select(sql`1`.as("one"))+ .whereRef("itemLedger.companyId", "=", "job.companyId")+ .whereRef("itemLedger.documentId", "=", "job.id")+ .where("itemLedger.documentType", "in", [+ "Job Consumption",+ "Job Receipt"+ ])+ .where("itemLedger.createdAt", "<", legacyCutoff)+ ),+ eb.exists(+ eb+ .selectFrom("productionEvent")+ .innerJoin("jobOperation", (join) =>+ join+ .onRef("jobOperation.id", "=", "productionEvent.jobOperationId")+ .onRef(+ "jobOperation.companyId",+ "=",+ "productionEvent.companyId"+ )+ )+ .select(sql`1`.as("one"))+ .whereRef("jobOperation.jobId", "=", "job.id")+ .whereRef("productionEvent.companyId", "=", "job.companyId")+ .where("productionEvent.createdAt", "<", legacyCutoff)+ ),+ eb.exists(+ eb+ .selectFrom("productionQuantity")+ .innerJoin("jobOperation", (join) =>+ join+ .onRef(+ "jobOperation.id",+ "=",+ "productionQuantity.jobOperationId"+ )+ .onRef(+ "jobOperation.companyId",+ "=",+ "productionQuantity.companyId"+ )+ )+ .select(sql`1`.as("one"))+ .whereRef("jobOperation.jobId", "=", "job.id")+ .whereRef("productionQuantity.companyId", "=", "job.companyId")+ .where("productionQuantity.createdAt", "<", legacyCutoff)+ )+ ]))- .orderBy("jobId")+ .orderBy("job.jobId").limit(READINESS_ITEM_LIMIT).execute();return {diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.poindex 0cf99d4533..6410d6572f 100644--- a/packages/locale/locales/de/erp.po+++ b/packages/locale/locales/de/erp.po@@ -94,8 +94,8 @@ msgid "{0, plural, one {# week} other {# weeks}}"msgstr "{0, plural, one {# Woche} other {# Wochen}}"#. placeholder {0}: check.count-msgid "{0, plural, one {Complete or cancel the # job created before Carbon recorded its costs.} other {Complete or cancel the # jobs created before Carbon recorded their costs.}}"-msgstr "{0, plural, one {Schließen Sie den # Fertigungsauftrag ab oder brechen Sie ihn ab, der erstellt wurde, bevor Carbon seine Kosten aufzeichnete.} other {Schließen Sie die # Fertigungsaufträge ab oder brechen Sie sie ab, die erstellt wurden, bevor Carbon ihre Kosten aufzeichneten.}}"+msgid "{0, plural, one {Complete or cancel the # job that took costs before Carbon recorded them.} other {Complete or cancel the # jobs that took costs before Carbon recorded them.}}"+msgstr "{0, plural, one {Schließen Sie den # Fertigungsauftrag ab oder brechen Sie ihn ab, der Kosten verursacht hat, bevor Carbon sie aufzeichnete.} other {Schließen Sie die # Fertigungsaufträge ab oder brechen Sie sie ab, die Kosten verursacht haben, bevor Carbon sie aufzeichnete.}}"#. placeholder {0}: check.countmsgid "{0, plural, one {Post or delete the # document dated before the cutover.} other {Post or delete the # documents dated before the cutover.}}"@@ -13862,8 +13862,8 @@ msgstr "Keine offenen Fertigungsaufträge für Kundenaufträge werden voraussichmsgid "No open jobs for sales orders at this location."msgstr "Keine offenen Fertigungsaufträge für Kundenaufträge an diesem Standort."-msgid "No open jobs from before Carbon recorded their costs"-msgstr "Keine offenen Fertigungsaufträge von vor der Kostenverfolgung in Carbon"+msgid "No open jobs with costs from before Carbon recorded them"+msgstr "Keine offenen Fertigungsaufträge mit Kosten von vor der Kostenverfolgung in Carbon"msgid "No open lines. Add a service to amend."msgstr "Keine offenen Positionen. Fügen Sie eine Dienstleistung hinzu, um zu ändern."diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.poindex 62b0ad01e6..422d334158 100644--- a/packages/locale/locales/en/erp.po+++ b/packages/locale/locales/en/erp.po@@ -94,8 +94,8 @@ msgid "{0, plural, one {# week} other {# weeks}}"msgstr "{0, plural, one {# week} other {# weeks}}"#. placeholder {0}: check.count-msgid "{0, plural, one {Complete or cancel the # job created before Carbon recorded its costs.} other {Complete or cancel the # jobs created before Carbon recorded their costs.}}"-msgstr "{0, plural, one {Complete or cancel the # job created before Carbon recorded its costs.} other {Complete or cancel the # jobs created before Carbon recorded their costs.}}"+msgid "{0, plural, one {Complete or cancel the # job that took costs before Carbon recorded them.} other {Complete or cancel the # jobs that took costs before Carbon recorded them.}}"+msgstr "{0, plural, one {Complete or cancel the # job that took costs before Carbon recorded them.} other {Complete or cancel the # jobs that took costs before Carbon recorded them.}}"#. placeholder {0}: check.countmsgid "{0, plural, one {Post or delete the # document dated before the cutover.} other {Post or delete the # documents dated before the cutover.}}"@@ -13862,8 +13862,8 @@ msgstr "No open jobs for sales orders are projected to complete at this locationmsgid "No open jobs for sales orders at this location."msgstr "No open jobs for sales orders at this location."-msgid "No open jobs from before Carbon recorded their costs"-msgstr "No open jobs from before Carbon recorded their costs"+msgid "No open jobs with costs from before Carbon recorded them"+msgstr "No open jobs with costs from before Carbon recorded them"msgid "No open lines. Add a service to amend."msgstr "No open lines. Add a service to amend."diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.poindex ece3cbe933..2720e13071 100644--- a/packages/locale/locales/es/erp.po+++ b/packages/locale/locales/es/erp.po@@ -94,8 +94,8 @@ msgid "{0, plural, one {# week} other {# weeks}}"msgstr "{0, plural, one {# semana} other {# semanas}}"#. placeholder {0}: check.count-msgid "{0, plural, one {Complete or cancel the # job created before Carbon recorded its costs.} other {Complete or cancel the # jobs created before Carbon recorded their costs.}}"-msgstr "{0, plural, one {Completar o cancelar la # Orden de trabajo creada antes de que Carbon registrara sus costos.} other {Completar o cancelar las # Órdenes de trabajo creadas antes de que Carbon registrara sus costos.}}"+msgid "{0, plural, one {Complete or cancel the # job that took costs before Carbon recorded them.} other {Complete or cancel the # jobs that took costs before Carbon recorded them.}}"+msgstr "{0, plural, one {Completar o cancelar la # Orden de trabajo que tuvo costos antes de que Carbon los registrara.} other {Completar o cancelar las # Órdenes de trabajo que tuvieron costos antes de que Carbon los registrara.}}"#. placeholder {0}: check.countmsgid "{0, plural, one {Post or delete the # document dated before the cutover.} other {Post or delete the # documents dated before the cutover.}}"@@ -13862,8 +13862,8 @@ msgstr "No hay órdenes de trabajo abiertas de pedidos de venta proyectadas paramsgid "No open jobs for sales orders at this location."msgstr "No hay órdenes de trabajo abiertas de pedidos de venta en esta ubicación."-msgid "No open jobs from before Carbon recorded their costs"-msgstr "Sin órdenes de trabajo abiertas de antes de que Carbon registrara sus costos"+msgid "No open jobs with costs from before Carbon recorded them"+msgstr "Sin órdenes de trabajo abiertas con costos de antes de que Carbon los registrara"msgid "No open lines. Add a service to amend."msgstr "No hay líneas abiertas. Añada un servicio para modificar."diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.poindex fcda009836..0c069bcc85 100644--- a/packages/locale/locales/fr/erp.po+++ b/packages/locale/locales/fr/erp.po@@ -94,8 +94,8 @@ msgid "{0, plural, one {# week} other {# weeks}}"msgstr "{0, plural, one {# semaine} other {# semaines}}"#. placeholder {0}: check.count-msgid "{0, plural, one {Complete or cancel the # job created before Carbon recorded its costs.} other {Complete or cancel the # jobs created before Carbon recorded their costs.}}"-msgstr "{0, plural, one {Terminez ou annulez l'ordre de fabrication # créé avant que Carbon n'enregistre ses coûts.} other {Terminez ou annulez les # ordres de fabrication créés avant que Carbon n'enregistre leurs coûts.}}"+msgid "{0, plural, one {Complete or cancel the # job that took costs before Carbon recorded them.} other {Complete or cancel the # jobs that took costs before Carbon recorded them.}}"+msgstr "{0, plural, one {Terminez ou annulez l'ordre de fabrication # qui a engagé des coûts avant que Carbon ne les enregistre.} other {Terminez ou annulez les # ordres de fabrication qui ont engagé des coûts avant que Carbon ne les enregistre.}}"#. placeholder {0}: check.countmsgid "{0, plural, one {Post or delete the # document dated before the cutover.} other {Post or delete the # documents dated before the cutover.}}"@@ -13862,8 +13862,8 @@ msgstr "Aucune ordre de fabrication ouverte pour les commandes client n'est prémsgid "No open jobs for sales orders at this location."msgstr "Aucune ordre de fabrication ouverte pour les commandes client sur ce site."-msgid "No open jobs from before Carbon recorded their costs"-msgstr "Aucun ordre de fabrication ouvert antérieur à l'enregistrement de ses coûts par Carbon"+msgid "No open jobs with costs from before Carbon recorded them"+msgstr "Aucun ordre de fabrication ouvert avec des coûts antérieurs à leur enregistrement par Carbon"msgid "No open lines. Add a service to amend."msgstr "Aucune ligne ouverte. Ajoutez un service pour modifier."diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.poindex f40df4840a..1a4f2bd04c 100644--- a/packages/locale/locales/hi/erp.po+++ b/packages/locale/locales/hi/erp.po@@ -94,8 +94,8 @@ msgid "{0, plural, one {# week} other {# weeks}}"msgstr "{0, plural, one {# सप्ताह} other {# सप्ताह}}"#. placeholder {0}: check.count-msgid "{0, plural, one {Complete or cancel the # job created before Carbon recorded its costs.} other {Complete or cancel the # jobs created before Carbon recorded their costs.}}"-msgstr "{0, plural, one {# जॉब को पूर्ण करें या रद्द करें जो Carbon ने लागत दर्ज करने से पहले बनाई गई थी।} other {# जॉबें को पूर्ण करें या रद्द करें जो Carbon ने लागत दर्ज करने से पहले बनाई गई थीं।}}"+msgid "{0, plural, one {Complete or cancel the # job that took costs before Carbon recorded them.} other {Complete or cancel the # jobs that took costs before Carbon recorded them.}}"+msgstr "{0, plural, one {# जॉब को पूर्ण करें या रद्द करें जिस पर Carbon के लागत दर्ज करने से पहले लागत लगी थी।} other {# जॉबें को पूर्ण करें या रद्द करें जिन पर Carbon के लागत दर्ज करने से पहले लागत लगी थी।}}"#. placeholder {0}: check.countmsgid "{0, plural, one {Post or delete the # document dated before the cutover.} other {Post or delete the # documents dated before the cutover.}}"@@ -13862,8 +13862,8 @@ msgstr "इस स्थान पर विक्रय आदेशों कmsgid "No open jobs for sales orders at this location."msgstr "इस स्थान पर विक्रय आदेशों के लिए कोई खुली जॉब नहीं है।"-msgid "No open jobs from before Carbon recorded their costs"-msgstr "कार्बन के द्वारा लागत दर्ज करने से पहले कोई खुला जॉब नहीं"+msgid "No open jobs with costs from before Carbon recorded them"+msgstr "Carbon के लागत दर्ज करने से पहले की लागत वाला कोई खुला जॉब नहीं"msgid "No open lines. Add a service to amend."msgstr "कोई खुली पंक्ति नहीं। संशोधन के लिए एक सेवा जोड़ें।"diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.poindex ae707bc0c5..dcc1ac3657 100644--- a/packages/locale/locales/it/erp.po+++ b/packages/locale/locales/it/erp.po@@ -94,8 +94,8 @@ msgid "{0, plural, one {# week} other {# weeks}}"msgstr "{0, plural, one {# settimana} other {# settimane}}"#. placeholder {0}: check.count-msgid "{0, plural, one {Complete or cancel the # job created before Carbon recorded its costs.} other {Complete or cancel the # jobs created before Carbon recorded their costs.}}"-msgstr "{0, plural, one {Completa o annulla l'# ordine di produzione creato prima che Carbon registrasse i relativi costi.} other {Completa o annulla gli # ordini di produzione creati prima che Carbon registrassero i relativi costi.}}"+msgid "{0, plural, one {Complete or cancel the # job that took costs before Carbon recorded them.} other {Complete or cancel the # jobs that took costs before Carbon recorded them.}}"+msgstr "{0, plural, one {Completa o annulla l'# ordine di produzione che ha sostenuto costi prima che Carbon li registrasse.} other {Completa o annulla gli # ordini di produzione che hanno sostenuto costi prima che Carbon li registrasse.}}"#. placeholder {0}: check.countmsgid "{0, plural, one {Post or delete the # document dated before the cutover.} other {Post or delete the # documents dated before the cutover.}}"@@ -13862,8 +13862,8 @@ msgstr "Nessun ordine di produzione aperto per gli ordini di vendita è previstomsgid "No open jobs for sales orders at this location."msgstr "Nessun ordine di produzione aperto per gli ordini di vendita in questa ubicazione."-msgid "No open jobs from before Carbon recorded their costs"-msgstr "Nessun ordine di produzione aperto da prima che Carbon ne registrasse i costi"+msgid "No open jobs with costs from before Carbon recorded them"+msgstr "Nessun ordine di produzione aperto con costi precedenti alla loro registrazione in Carbon"msgid "No open lines. Add a service to amend."msgstr "Nessuna riga aperta. Aggiungi un servizio per modificare."diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.poindex 2aec585f8f..ccb415c7ef 100644--- a/packages/locale/locales/ja/erp.po+++ b/packages/locale/locales/ja/erp.po@@ -94,8 +94,8 @@ msgid "{0, plural, one {# week} other {# weeks}}"msgstr "{0, plural, other {#週}}"#. placeholder {0}: check.count-msgid "{0, plural, one {Complete or cancel the # job created before Carbon recorded its costs.} other {Complete or cancel the # jobs created before Carbon recorded their costs.}}"-msgstr "{0, plural, one {Carbon が原価を記録する前に作成された # 製造指図を完了またはキャンセルしてください。} other {Carbon が原価を記録する前に作成された # 製造指図を完了またはキャンセルしてください。}}"+msgid "{0, plural, one {Complete or cancel the # job that took costs before Carbon recorded them.} other {Complete or cancel the # jobs that took costs before Carbon recorded them.}}"+msgstr "{0, plural, one {Carbon が原価を記録する前に原価が発生した # 製造指図を完了またはキャンセルしてください。} other {Carbon が原価を記録する前に原価が発生した # 製造指図を完了またはキャンセルしてください。}}"#. placeholder {0}: check.countmsgid "{0, plural, one {Post or delete the # document dated before the cutover.} other {Post or delete the # documents dated before the cutover.}}"@@ -13862,8 +13862,8 @@ msgstr "この拠点で、次の{horizon}日間に完了予定のオープン受msgid "No open jobs for sales orders at this location."msgstr "この拠点にはオープン受注用製造指図がありません。"-msgid "No open jobs from before Carbon recorded their costs"-msgstr "原価が記録される前のオープン製造指図がありません"+msgid "No open jobs with costs from before Carbon recorded them"+msgstr "Carbon が記録する前の原価があるオープン製造指図がありません"msgid "No open lines. Add a service to amend."msgstr "未完了の明細はありません。変更するにはサービスを追加してください。"diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.poindex 7096c54c18..95ed800d91 100644--- a/packages/locale/locales/ko/erp.po+++ b/packages/locale/locales/ko/erp.po@@ -94,8 +94,8 @@ msgid "{0, plural, one {# week} other {# weeks}}"msgstr "{0, plural, other {#주}}"#. placeholder {0}: check.count-msgid "{0, plural, one {Complete or cancel the # job created before Carbon recorded its costs.} other {Complete or cancel the # jobs created before Carbon recorded their costs.}}"-msgstr "{0, plural, one {Carbon이 원가를 기록하기 전에 생성된 # 작업 지시를 완료 처리하거나 취소하세요.} other {Carbon이 원가를 기록하기 전에 생성된 # 작업 지시를 완료 처리하거나 취소하세요.}}"+msgid "{0, plural, one {Complete or cancel the # job that took costs before Carbon recorded them.} other {Complete or cancel the # jobs that took costs before Carbon recorded them.}}"+msgstr "{0, plural, one {Carbon이 원가를 기록하기 전에 원가가 발생한 # 작업 지시를 완료 처리하거나 취소하세요.} other {Carbon이 원가를 기록하기 전에 원가가 발생한 # 작업 지시를 완료 처리하거나 취소하세요.}}"#. placeholder {0}: check.countmsgid "{0, plural, one {Post or delete the # document dated before the cutover.} other {Post or delete the # documents dated before the cutover.}}"@@ -13862,8 +13862,8 @@ msgstr "이 사업장에서 다음 {horizon}일 이내에 완료될 것으로msgid "No open jobs for sales orders at this location."msgstr "이 사업장의 수주 관련 미결 작업 지시가 없습니다."-msgid "No open jobs from before Carbon recorded their costs"-msgstr "Carbon이 원가를 기록하기 전의 미결 작업 지시가 없습니다."+msgid "No open jobs with costs from before Carbon recorded them"+msgstr "Carbon이 기록하기 전의 원가가 있는 미결 작업 지시가 없습니다."msgid "No open lines. Add a service to amend."msgstr "열린 라인이 없습니다. 변경하려면 서비스를 추가하세요."diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.poindex eaffebd7a6..ec8302aa7d 100644--- a/packages/locale/locales/pl/erp.po+++ b/packages/locale/locales/pl/erp.po@@ -94,8 +94,8 @@ msgid "{0, plural, one {# week} other {# weeks}}"msgstr "{0, plural, one {# tydzień} few {# tygodnie} many {# tygodni} other {# tygodnia}}"#. placeholder {0}: check.count-msgid "{0, plural, one {Complete or cancel the # job created before Carbon recorded its costs.} other {Complete or cancel the # jobs created before Carbon recorded their costs.}}"-msgstr "{0, plural, one {Ukończ lub anuluj # zlecenie produkcyjne utworzone przed zarejestrowaniem przez Carbon jego kosztów.} other {Ukończ lub anuluj # zleceń produkcyjnych utworzonych przed zarejestrowaniem przez Carbon ich kosztów.}}"+msgid "{0, plural, one {Complete or cancel the # job that took costs before Carbon recorded them.} other {Complete or cancel the # jobs that took costs before Carbon recorded them.}}"+msgstr "{0, plural, one {Ukończ lub anuluj # zlecenie produkcyjne, które poniosło koszty przed ich zarejestrowaniem przez Carbon.} other {Ukończ lub anuluj # zleceń produkcyjnych, które poniosły koszty przed ich zarejestrowaniem przez Carbon.}}"#. placeholder {0}: check.countmsgid "{0, plural, one {Post or delete the # document dated before the cutover.} other {Post or delete the # documents dated before the cutover.}}"@@ -13862,8 +13862,8 @@ msgstr "Brak otwartych zleceń produkcyjnych dla zamówień sprzedaży, którychmsgid "No open jobs for sales orders at this location."msgstr "Brak otwartych zleceń produkcyjnych dla zamówień sprzedaży w tej lokalizacji."-msgid "No open jobs from before Carbon recorded their costs"-msgstr "Brak otwartych zleceń produkcyjnych z okresu sprzed rejestracji kosztów w Carbon"+msgid "No open jobs with costs from before Carbon recorded them"+msgstr "Brak otwartych zleceń produkcyjnych z kosztami sprzed ich rejestracji w Carbon"msgid "No open lines. Add a service to amend."msgstr "Brak otwartych pozycji. Dodaj usługę, aby wprowadzić zmianę."diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.poindex ee126d47c2..e8d1d07d2a 100644--- a/packages/locale/locales/pt/erp.po+++ b/packages/locale/locales/pt/erp.po@@ -94,8 +94,8 @@ msgid "{0, plural, one {# week} other {# weeks}}"msgstr "{0, plural, one {# semana} other {# semanas}}"#. placeholder {0}: check.count-msgid "{0, plural, one {Complete or cancel the # job created before Carbon recorded its costs.} other {Complete or cancel the # jobs created before Carbon recorded their costs.}}"-msgstr "{0, plural, one {Concluir ou cancelar a # ordem de produção criada antes de o Carbon registrar seus custos.} other {Concluir ou cancelar as # ordens de produção criadas antes de o Carbon registrar seus custos.}}"+msgid "{0, plural, one {Complete or cancel the # job that took costs before Carbon recorded them.} other {Complete or cancel the # jobs that took costs before Carbon recorded them.}}"+msgstr "{0, plural, one {Concluir ou cancelar a # ordem de produção que teve custos antes de o Carbon registrá-los.} other {Concluir ou cancelar as # ordens de produção que tiveram custos antes de o Carbon registrá-los.}}"#. placeholder {0}: check.countmsgid "{0, plural, one {Post or delete the # document dated before the cutover.} other {Post or delete the # documents dated before the cutover.}}"@@ -13862,8 +13862,8 @@ msgstr "Nenhuma ordem de produção aberta para Pedidos de venda está previstamsgid "No open jobs for sales orders at this location."msgstr "Nenhuma ordem de produção aberta para Pedidos de venda neste Local."-msgid "No open jobs from before Carbon recorded their costs"-msgstr "Nenhuma ordem de produção aberta anterior ao registro de seus custos no Carbon"+msgid "No open jobs with costs from before Carbon recorded them"+msgstr "Nenhuma ordem de produção aberta com custos anteriores ao seu registro no Carbon"msgid "No open lines. Add a service to amend."msgstr "Nenhuma linha aberta. Adicione um serviço para alterar."diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.poindex 4d4132eea6..fe5ba1b137 100644--- a/packages/locale/locales/ru/erp.po+++ b/packages/locale/locales/ru/erp.po@@ -94,8 +94,8 @@ msgid "{0, plural, one {# week} other {# weeks}}"msgstr "{0, plural, one {# неделя} few {# недели} many {# недель} other {# недели}}"#. placeholder {0}: check.count-msgid "{0, plural, one {Complete or cancel the # job created before Carbon recorded its costs.} other {Complete or cancel the # jobs created before Carbon recorded their costs.}}"-msgstr "{0, plural, one {Завершить или отменить # производственный заказ, созданный до того, как Carbon записал его затраты.} other {Завершить или отменить # производственные заказы, созданные до того, как Carbon записал их затраты.}}"+msgid "{0, plural, one {Complete or cancel the # job that took costs before Carbon recorded them.} other {Complete or cancel the # jobs that took costs before Carbon recorded them.}}"+msgstr "{0, plural, one {Завершить или отменить # производственный заказ, по которому были затраты до того, как Carbon начал их записывать.} other {Завершить или отменить # производственные заказы, по которым были затраты до того, как Carbon начал их записывать.}}"#. placeholder {0}: check.countmsgid "{0, plural, one {Post or delete the # document dated before the cutover.} other {Post or delete the # documents dated before the cutover.}}"@@ -13862,8 +13862,8 @@ msgstr "На этой площадке не прогнозируется завmsgid "No open jobs for sales orders at this location."msgstr "На этой площадке нет открытых производственных заказов по заказам покупателей."-msgid "No open jobs from before Carbon recorded their costs"-msgstr "Нет открытых производственных заказов, существовавших до того, как Carbon записал их затраты"+msgid "No open jobs with costs from before Carbon recorded them"+msgstr "Нет открытых производственных заказов с затратами до того, как Carbon начал их записывать"msgid "No open lines. Add a service to amend."msgstr "Нет открытых строк. Добавьте услугу, чтобы внести изменение."diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.poindex d2bdc290be..96d9ab639a 100644--- a/packages/locale/locales/tr/erp.po+++ b/packages/locale/locales/tr/erp.po@@ -94,8 +94,8 @@ msgid "{0, plural, one {# week} other {# weeks}}"msgstr "{0, plural, one {# hafta} other {# hafta}}"#. placeholder {0}: check.count-msgid "{0, plural, one {Complete or cancel the # job created before Carbon recorded its costs.} other {Complete or cancel the # jobs created before Carbon recorded their costs.}}"-msgstr "{0, plural, one {Maliyet kaydedilmeden önce oluşturulan # iş emrini tamamla veya iptal et.} other {Maliyet kaydedilmeden önce oluşturulan # iş emirlerini tamamla veya iptal et.}}"+msgid "{0, plural, one {Complete or cancel the # job that took costs before Carbon recorded them.} other {Complete or cancel the # jobs that took costs before Carbon recorded them.}}"+msgstr "{0, plural, one {Carbon maliyetleri kaydetmeden önce maliyet oluşan # iş emrini tamamla veya iptal et.} other {Carbon maliyetleri kaydetmeden önce maliyet oluşan # iş emirlerini tamamla veya iptal et.}}"#. placeholder {0}: check.countmsgid "{0, plural, one {Post or delete the # document dated before the cutover.} other {Post or delete the # documents dated before the cutover.}}"@@ -13862,8 +13862,8 @@ msgstr "Bu lokasyonda sonraki {horizon} gün içinde tamamlanması beklenen satmsgid "No open jobs for sales orders at this location."msgstr "Bu lokasyonda satış siparişleri için açık iş emri yok."-msgid "No open jobs from before Carbon recorded their costs"-msgstr "Carbon'un maliyetlerini kaydedebilmesinden ön açık iş emirleri yok"+msgid "No open jobs with costs from before Carbon recorded them"+msgstr "Carbon'un kaydetmesinden önceki maliyetleri olan açık iş emri yok"msgid "No open lines. Add a service to amend."msgstr "Açık satır yok. Değişiklik için bir hizmet ekleyin."diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.poindex 29e609a7e7..aa7f9dd649 100644--- a/packages/locale/locales/zh/erp.po+++ b/packages/locale/locales/zh/erp.po@@ -94,8 +94,8 @@ msgid "{0, plural, one {# week} other {# weeks}}"msgstr "{0, plural, other {#周}}"#. placeholder {0}: check.count-msgid "{0, plural, one {Complete or cancel the # job created before Carbon recorded its costs.} other {Complete or cancel the # jobs created before Carbon recorded their costs.}}"-msgstr "{0, plural, one {完成或取消在 Carbon 记录成本之前创建的 # 个工单。} other {完成或取消在 Carbon 记录成本之前创建的 # 个工单。}}"+msgid "{0, plural, one {Complete or cancel the # job that took costs before Carbon recorded them.} other {Complete or cancel the # jobs that took costs before Carbon recorded them.}}"+msgstr "{0, plural, one {完成或取消在 Carbon 记录成本之前已产生成本的 # 个工单。} other {完成或取消在 Carbon 记录成本之前已产生成本的 # 个工单。}}"#. placeholder {0}: check.countmsgid "{0, plural, one {Post or delete the # document dated before the cutover.} other {Post or delete the # documents dated before the cutover.}}"@@ -13862,8 +13862,8 @@ msgstr "该地点在接下来{horizon}天内没有计划完成的销售订单相msgid "No open jobs for sales orders at this location."msgstr "此地点没有销售订单相关的未结工单。"-msgid "No open jobs from before Carbon recorded their costs"-msgstr "没有来自Carbon记录成本之前的未结工单"+msgid "No open jobs with costs from before Carbon recorded them"+msgstr "没有在 Carbon 记录成本之前已产生成本的未结工单"msgid "No open lines. Add a service to amend."msgstr "没有未结行。添加服务以进行修改。"diff --git a/packages/server-functions/src/activate-accounting/reads.test.ts b/packages/server-functions/src/activate-accounting/reads.test.tsindex 2e6f5159f5..b62a09417e 100644--- a/packages/server-functions/src/activate-accounting/reads.test.ts+++ b/packages/server-functions/src/activate-accounting/reads.test.ts@@ -1026,3 +1026,127 @@ databaseTest(}});++databaseTest(+ "readiness blocks only the open jobs that took cost before Carbon recorded it",+ async () => {+ const f = await cutoverReadsFixture();+ try {+ const assemblyId = `${f.prefix}-assembly`;+ const processId = `${f.prefix}-process`;+ const job = (name: string) => `${f.prefix}-${name}`;+ await f.db.transaction().execute(async (trx) => {+ await sql`SET LOCAL "app.sync_in_progress" = 'true'`.execute(trx);+ await trx+ .insertInto("item")+ .values({+ id: assemblyId,+ readableId: `${f.prefix}-ASSY`,+ name: "Assembly",+ type: "Part",+ itemTrackingType: "Inventory",+ replenishmentSystem: "Make",+ companyId: f.companyId,+ createdBy: USER+ })+ .execute();+ await trx+ .insertInto("process")+ .values({+ id: processId,+ name: "Assemble",+ defaultStandardFactor: "Hours/Piece",+ companyId: f.companyId,+ createdBy: USER+ })+ .execute();+ await trx+ .insertInto("job")+ .values(+ (+ [+ ["draft", "J-DRAFT", "Draft"],+ ["planned", "J-PLANNED", "Planned"],+ ["issued", "J-ISSUED", "In Progress"],+ ["timed", "J-TIMED", "In Progress"],+ ["done", "J-DONE", "Completed"]+ ] as const+ ).map(([name, jobId, status]) => ({+ id: job(name),+ jobId,+ status,+ itemId: assemblyId,+ quantity: 1,+ unitOfMeasureCode: "EA",+ locationId: f.locationId,+ companyId: f.companyId,+ createdBy: USER+ }))+ )+ .execute();+ });++ // A material issue to J-ISSUED and to the completed J-DONE, and a time+ // entry on J-TIMED, all before the company's first journal.+ await f.db+ .insertInto("itemLedger")+ .values(+ [job("issued"), job("done")].map((documentId) => ({+ entryType: "Consumption" as const,+ documentType: "Job Consumption" as const,+ documentId,+ itemId: f.partId,+ quantity: -1,+ locationId: f.locationId,+ postingDate: f.today,+ companyId: f.companyId,+ createdBy: USER+ }))+ )+ .execute();+ const timedMethod = await f.db+ .selectFrom("jobMakeMethod")+ .select("id")+ .where("jobId", "=", job("timed"))+ .where("companyId", "=", f.companyId)+ .executeTakeFirstOrThrow();+ const operation = await f.db+ .insertInto("jobOperation")+ .values({+ jobId: job("timed"),+ jobMakeMethodId: timedMethod.id,+ processId,+ description: "Assemble",+ companyId: f.companyId,+ createdBy: USER+ })+ .returning("id")+ .executeTakeFirstOrThrow();+ await f.db+ .insertInto("productionEvent")+ .values({+ jobOperationId: operation.id,+ type: "Labor",+ startTime: datetime.timestamp(),+ companyId: f.companyId,+ createdBy: USER+ })+ .execute();++ const { checks } = await getActivationReadiness(f.db, {+ companyId: f.companyId,+ cutoverDate: f.cutoverDate+ });+ const legacyJobs = checks.find((c) => c.key === "legacy-jobs")!;++ // The Draft and Planned jobs took no cost, and J-DONE is closed.+ expect(legacyJobs).toMatchObject({ passed: false, count: 2 });+ expect(legacyJobs.items.map((item) => item.readableId)).toEqual([+ "J-ISSUED",+ "J-TIMED"+ ]);+ } finally {+ await f.cleanup();+ }+ }+);