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): completing a job now completes its operation quantities (#1699)
Anshul sharmabd5a740566ac
diff --git a/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json b/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.jsonindex fc1c3605d6..e7afbe341c 100644--- a/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json+++ b/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json@@ -209,7 +209,7 @@{"name":"inventory_getKanban","classification":"READ","paramCount":1,"schema":"369f807bc840","response":"c5aa7a081ed4","injectAuth":"companyId","permission":"inventory:view","paginates":false},{"name":"inventory_getKanbans","classification":"READ","paramCount":2,"schema":"68cb4a73d5a9","response":"fa96e94d8dda","injectAuth":"companyId","permission":"inventory:view","paginates":true},{"name":"inventory_getPickingList","classification":"READ","paramCount":1,"schema":"0a4ec3e7319b","response":"227255936b96","injectAuth":"companyId","permission":"inventory:view","paginates":false},- {"name":"inventory_getPickingListAvailability","classification":"READ","paramCount":1,"schema":"0a4ec3e7319b","response":"6344f0c3583c","injectAuth":"companyId","permission":"inventory:view","paginates":false},+ {"name":"inventory_getPickingListAvailability","classification":"READ","paramCount":1,"schema":"0a4ec3e7319b","response":"e5b05a2b7ffe","injectAuth":"companyId","permission":"inventory:view","paginates":false},{"name":"inventory_getPickingListLine","classification":"READ","paramCount":1,"schema":"063a6777d378","response":"b51ad23d436f","injectAuth":"companyId","permission":"inventory:view","paginates":false},{"name":"inventory_getPickingListLines","classification":"READ","paramCount":1,"schema":"0a4ec3e7319b","response":"07d244c0f017","injectAuth":"companyId","permission":"inventory:view","paginates":false},{"name":"inventory_getPickingListLineTrackedEntities","classification":"READ","paramCount":1,"schema":"063a6777d378","response":"51dd622ce168","injectAuth":"companyId","permission":"inventory:view","paginates":false},@@ -303,7 +303,7 @@{"name":"inventory_upsertWarehouseTransfer","classification":"WRITE","paramCount":10,"schema":"8af29a9b1929","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"inventory:create+update","paginates":false},{"name":"inventory_upsertWarehouseTransferLine","classification":"WRITE","paramCount":1,"schema":"93538fae689b","response":"237082879d41","injectAuth":"companyId+createdBy+updatedBy","permission":"inventory:create+update","paginates":false},{"name":"invoicing_applyCreditsToInvoices","classification":"DESTRUCTIVE","paramCount":4,"schema":"404db2e47d09","response":"none","injectAuth":"companyId+createdBy","permission":"invoicing:update","paginates":false},- {"name":"invoicing_computeEarlyPaymentDiscounts","classification":"READ","paramCount":3,"schema":"0069677fb034","response":"6344f0c3583c","injectAuth":"companyId","permission":"invoicing:view","paginates":false},+ {"name":"invoicing_computeEarlyPaymentDiscounts","classification":"READ","paramCount":3,"schema":"0069677fb034","response":"e5b05a2b7ffe","injectAuth":"companyId","permission":"invoicing:view","paginates":false},{"name":"invoicing_computeInvoiceDateDue","classification":"READ","paramCount":2,"schema":"c07433aded5b","response":"174e29b899b9","injectAuth":"companyId","permission":"invoicing:view","paginates":false},{"name":"invoicing_createPurchaseInvoiceFromPurchaseOrder","classification":"WRITE","paramCount":1,"schema":"28cffcd9d6e8","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"invoicing:create","paginates":false},{"name":"invoicing_createSalesInvoiceFromSalesOrder","classification":"WRITE","paramCount":1,"schema":"d160a49d6787","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"invoicing:create","paginates":false},@@ -408,7 +408,7 @@{"name":"items_findChangeNoticesForItem","classification":"READ","paramCount":2,"schema":"10c8230a9f49","response":"e0196d4b0041","injectAuth":"companyId","permission":"parts:view","paginates":false},{"name":"items_findOtherOpenChangeNoticesForItem","classification":"READ","paramCount":2,"schema":"8a1da983320d","response":"e0196d4b0041","injectAuth":"companyId","permission":"parts:view","paginates":false},{"name":"items_getBomHasShelfLifeManagedInput","classification":"READ","paramCount":1,"schema":"623ca47a6c74","response":"7cb541e84f22","injectAuth":"companyId","permission":"parts:view","paginates":false},- {"name":"items_getBomItemAttributes","classification":"READ","paramCount":1,"schema":"c4ca22fd1816","response":"6344f0c3583c","injectAuth":"companyId","permission":"parts:view","paginates":false},+ {"name":"items_getBomItemAttributes","classification":"READ","paramCount":1,"schema":"c4ca22fd1816","response":"e5b05a2b7ffe","injectAuth":"companyId","permission":"parts:view","paginates":false},{"name":"items_getChangeNotice","classification":"READ","paramCount":1,"schema":"29578070edb2","response":"09c0b464284c","injectAuth":"companyId","permission":"parts:view","paginates":false},{"name":"items_getChangeNoticeActions","classification":"READ","paramCount":1,"schema":"29578070edb2","response":"949f86b5cda3","injectAuth":"companyId","permission":"parts:view","paginates":false},{"name":"items_getChangeNoticeAffectedItems","classification":"READ","paramCount":1,"schema":"29578070edb2","response":"5483e69d7515","injectAuth":"companyId","permission":"parts:view","paginates":false},@@ -788,13 +788,13 @@{"name":"production_insertJob","classification":"WRITE","paramCount":2,"schema":"fea224e085b1","response":"ad63dfd9d877","injectAuth":"companyId+createdBy+updatedBy","permission":"production:create","paginates":false},{"name":"production_invalidateAssemblyModelCache","classification":"DESTRUCTIVE","paramCount":1,"schema":"277f7d872d8c","response":"bcde375ebd4c","injectAuth":"companyId","permission":"production:update","paginates":false},{"name":"production_issueMaterial","classification":"WRITE","paramCount":7,"schema":"0408bd8c9bde","response":"none","injectAuth":"companyId","permission":"production:update","paginates":false},- {"name":"production_maxToolQuantityByItem","classification":"WRITE","paramCount":1,"schema":"8b9e90037b9a","response":"6344f0c3583c","injectAuth":"companyId","permission":"production:update","paginates":false},+ {"name":"production_maxToolQuantityByItem","classification":"WRITE","paramCount":1,"schema":"8b9e90037b9a","response":"e5b05a2b7ffe","injectAuth":"companyId","permission":"production:update","paginates":false},{"name":"production_movePeopleAssignment","classification":"DESTRUCTIVE","paramCount":2,"schema":"a726aa587ccc","response":"fe5e1dc03da5","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},{"name":"production_movePeopleWeek","classification":"DESTRUCTIVE","paramCount":5,"schema":"fec8ebf1add4","response":"3badaa1686e8","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},{"name":"production_notifyScheduleInputsChanged","classification":"WRITE","paramCount":3,"schema":"172bee52ed70","response":"none","injectAuth":"companyId","permission":"production:update","paginates":false},- {"name":"production_planAssemblyStepMarkerRemap","classification":"WRITE","paramCount":2,"schema":"e8a18fd41775","response":"6344f0c3583c","injectAuth":"companyId","permission":"production:update","paginates":false},- {"name":"production_planAssemblyStepMarkerSync","classification":"WRITE","paramCount":2,"schema":"f32958f213ae","response":"09dcd1bcb763","injectAuth":"companyId","permission":"production:update","paginates":false},- {"name":"production_planOrphanStepAdoption","classification":"WRITE","paramCount":3,"schema":"aae2658d9922","response":"6344f0c3583c","injectAuth":"companyId","permission":"production:update","paginates":false},+ {"name":"production_planAssemblyStepMarkerRemap","classification":"WRITE","paramCount":2,"schema":"e8a18fd41775","response":"e5b05a2b7ffe","injectAuth":"companyId","permission":"production:update","paginates":false},+ {"name":"production_planAssemblyStepMarkerSync","classification":"WRITE","paramCount":2,"schema":"f32958f213ae","response":"c9a5184a4f26","injectAuth":"companyId","permission":"production:update","paginates":false},+ {"name":"production_planOrphanStepAdoption","classification":"WRITE","paramCount":3,"schema":"aae2658d9922","response":"e5b05a2b7ffe","injectAuth":"companyId","permission":"production:update","paginates":false},{"name":"production_pullJobMaterialMakeMethod","classification":"WRITE","paramCount":2,"schema":"e27f48bbab4c","response":"bcde375ebd4c","injectAuth":"companyId+userId","permission":"production:update","paginates":false},{"name":"production_reassignAssemblyStepComponents","classification":"DESTRUCTIVE","paramCount":4,"schema":"99f3d689165d","response":"none","injectAuth":"companyId","permission":"production:update","paginates":false},{"name":"production_recalculateJobMakeMethodRequirements","classification":"WRITE","paramCount":1,"schema":"3797626bd17e","response":"none","injectAuth":"companyId+updatedBy+userId","permission":"production:update","paginates":false},diff --git a/apps/erp/app/routes/x+/job+/$jobId.complete.tsx b/apps/erp/app/routes/x+/job+/$jobId.complete.tsxindex da9d061cc6..5758e9f695 100644--- a/apps/erp/app/routes/x+/job+/$jobId.complete.tsx+++ b/apps/erp/app/routes/x+/job+/$jobId.complete.tsx@@ -54,9 +54,15 @@ export async function action({ request, params }: ActionFunctionArgs) {});if (rpc.error) {+ // complete_job_to_inventory refuses completions it cannot satisfy (serials+ // outstanding, quantity below what was received). Those are validation+ // failures, and its message is the only thing that says what to do next.throw redirect(requestReferrer(request) ?? path.to.job(jobId),- await flash(request, error(rpc.error, "Failed to complete job"))+ await flash(+ request,+ error(rpc.error, rpc.error.message || "Failed to complete job")+ ));}diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex 4f4ae05f7f..4fe2e823e2 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -82039,6 +82039,14 @@ export type Database = {Returns: boolean}company_today: { Args: { p_company_id: string }; Returns: string }+ complete_job_remaining_quantities: {+ Args: {+ p_job_id: string+ p_quantity_complete: number+ p_user_id: string+ }+ Returns: undefined+ }complete_job_to_inventory: {Args: {p_company_id?: string@@ -84677,6 +84685,14 @@ export type Database = {Args: { p_new: Json; p_old: Json; p_operation: string; p_table: string }Returns: undefined}+ terminal_job_operations: {+ Args: { p_job_id: string }+ Returns: {+ id: string+ quantityComplete: number+ quantityReworked: number+ }[]+ }translateTrialBalance: {Args: {p_company_group_id: stringdiff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.tsindex 4f4ae05f7f..4fe2e823e2 100644--- a/packages/database/supabase/functions/lib/types.ts+++ b/packages/database/supabase/functions/lib/types.ts@@ -82039,6 +82039,14 @@ export type Database = {Returns: boolean}company_today: { Args: { p_company_id: string }; Returns: string }+ complete_job_remaining_quantities: {+ Args: {+ p_job_id: string+ p_quantity_complete: number+ p_user_id: string+ }+ Returns: undefined+ }complete_job_to_inventory: {Args: {p_company_id?: string@@ -84677,6 +84685,14 @@ export type Database = {Args: { p_new: Json; p_old: Json; p_operation: string; p_table: string }Returns: undefined}+ terminal_job_operations: {+ Args: { p_job_id: string }+ Returns: {+ id: string+ quantityComplete: number+ quantityReworked: number+ }[]+ }translateTrialBalance: {Args: {p_company_group_id: stringdiff --git a/packages/database/supabase/migrations/20260922050131_mark-complete-completes-remaining-quantities.sql b/packages/database/supabase/migrations/20260922050131_mark-complete-completes-remaining-quantities.sqlnew file mode 100644index 0000000000..41387e85ad--- /dev/null+++ b/packages/database/supabase/migrations/20260922050131_mark-complete-completes-remaining-quantities.sql@@ -0,0 +1,1029 @@+-- "Mark as Complete" completes the remaining quantities, not just the status.+--+-- Bug: completing a job from the ERP dialog (or the MCP tool) set+-- job.status = 'Completed' and received the goods, but left every operation's+-- quantityComplete where it was. An operation is only Done once its reported+-- quantity reaches its target, so the routing stayed open and the job kept+-- reading In Progress behind a Completed status. Inventory and the backflush+-- were always correct; it is the operation-level record that was missing.+--+-- Fix: before the status flip, close each open terminal operation — set its+-- quantityComplete to the quantity being completed, and its status to Done.+-- Both are required: the auto-Done predicate lives in+-- sync_update_job_operation_quantities, which fires on productionQuantity+-- writes rather than on a jobOperation update, so a quantity-only write would+-- leave the routing open behind a Completed job.+--+-- No synthetic productionQuantity row is inserted. A desk completion is not+-- shop-floor production and must not fabricate operator-attributed history.+--+-- Closing an operation fires sync_finish_job_operation, which completes the job+-- through the same path MES uses. That re-entry is NOT free: it is a BEFORE row+-- trigger, so it reads the operation's OLD quantityComplete (0 on a desk+-- completion), falls back to the job's planned quantity and receives a SECOND+-- time, while this call's receipt delta was already computed. The close-out+-- therefore runs AFTER the status flip, where the interceptor's Ready/In+-- Progress/Paused gate returns early and no second receipt is posted.+--+-- Serial-tracked jobs are the exception. A serial unit is an individually+-- numbered trackedEntity and cannot be conjured here without bypassing+-- assign-serial-numbers, so a serial job with units still outstanding is+-- refused and the whole completion rolls back — never Completed on a serial+-- requirement that was not satisfied. A serial job already finished in MES has+-- no shortfall and completes normally.+--+-- complete_job_to_inventory is recreated VERBATIM from its newest committed+-- definition (20260916131445_merge-aware-job-receipt.sql); the ONLY change is+-- the PERFORM below, placed immediately AFTER the status UPDATE so the+-- interceptor's roll-up skips the now-Completed job instead of receiving it+-- twice.++-- The 3-argument form below replaces an unreleased 4-argument version that took+-- p_company_id. CREATE OR REPLACE cannot replace a different signature, so drop+-- it explicitly rather than leave a second, callable overload behind.+DROP FUNCTION IF EXISTS complete_job_remaining_quantities(TEXT, NUMERIC, TEXT, TEXT);++-- A job's OPEN terminal top-level operations: the ones that finish the job's+-- own product, with no further top-level operation depending on them.+--+-- The same predicate is already inlined in sync_finish_job_operation and+-- sync_update_job_operation_quantities; those keep their copies (forking them+-- is a separate change), but new callers share this definition rather than+-- adding a fourth.+CREATE OR REPLACE FUNCTION terminal_job_operations(p_job_id TEXT)+RETURNS TABLE ("id" TEXT, "quantityComplete" NUMERIC, "quantityReworked" NUMERIC)+LANGUAGE sql+STABLE+SECURITY DEFINER+SET search_path = public+AS $$+ SELECT jo.id, jo."quantityComplete", jo."quantityReworked"+ FROM "jobOperation" jo+ INNER JOIN "jobMakeMethod" jmm ON jmm.id = jo."jobMakeMethodId"+ WHERE jo."jobId" = p_job_id+ AND jmm."parentMaterialId" IS NULL+ AND jo.status NOT IN ('Canceled', 'Done')+ AND NOT EXISTS (+ SELECT 1+ FROM "jobOperationDependency" dep+ INNER JOIN "jobOperation" child_jo ON child_jo.id = dep."operationId"+ INNER JOIN "jobMakeMethod" child_jmm ON child_jmm.id = child_jo."jobMakeMethodId"+ WHERE dep."dependsOnId" = jo.id+ AND child_jmm."parentMaterialId" IS NULL+ );+$$;+++-- Close the job's terminal operations at p_quantity_complete, so the routing+-- agrees with a job that is about to be marked Completed.+CREATE OR REPLACE FUNCTION complete_job_remaining_quantities(+ p_job_id TEXT,+ p_quantity_complete NUMERIC,+ p_user_id TEXT+)+RETURNS VOID+LANGUAGE plpgsql+SECURITY DEFINER+SET search_path = public+AS $$+DECLARE+ v_shortfall NUMERIC;+BEGIN+ -- Only the manual path closes operations. Under a trigger this is the MES+ -- path, where the floor reports its own quantities — and where writing a+ -- sibling jobOperation row fails with "tuple to be updated was already+ -- modified by an operation triggered by the current command", since+ -- sync_finish_job_operation is a BEFORE trigger mid-statement on those rows.+ IF pg_trigger_depth() > 0 THEN+ RETURN;+ END IF;++ -- The largest shortfall across the terminal operations. MAX, not SUM: these+ -- are parallel paths to the same finished part and each must report the full+ -- quantity, so summing them would invent units nobody required. Reworked+ -- units already satisfy the auto-Done predicate, so they count as reported.+ SELECT COALESCE(MAX(+ p_quantity_complete+ - COALESCE(t."quantityComplete", 0)+ - COALESCE(t."quantityReworked", 0)+ ), 0)+ INTO v_shortfall+ FROM terminal_job_operations(p_job_id) t;++ IF v_shortfall <= 0 THEN+ RETURN;+ END IF;++ IF EXISTS (+ SELECT 1 FROM "jobMakeMethod"+ WHERE "jobId" = p_job_id+ AND "parentMaterialId" IS NULL+ AND "requiresSerialTracking"+ ) THEN+ RAISE EXCEPTION 'Job % has % unit(s) left to complete — a serial number is required, so complete them in MES before completing the job',+ (SELECT "jobId" FROM "job" WHERE id = p_job_id), v_shortfall;+ END IF;++ -- Status as well as quantity. The auto-Done predicate lives in+ -- sync_update_job_operation_quantities, which fires on productionQuantity+ -- writes — not on a jobOperation update — so nothing else would close these+ -- operations, and a quantity-only write would leave the routing open behind a+ -- Completed job: the very symptom this function exists to remove.+ --+ -- Setting status here fires sync_finish_job_operation on each row. The caller+ -- must therefore have marked the job Completed already: the interceptor's+ -- status gate then returns early. Called while the job is still open it would+ -- instead re-enter complete_job_to_inventory and, being a BEFORE row trigger+ -- reading the pre-update quantityComplete, receive the goods a second time.+ --+ -- Every open terminal operation is closed, not only the short ones: an+ -- operation whose quantity already meets the target is Done by the same+ -- predicate the interceptor uses, so leaving it Ready on a Completed job+ -- would recreate the inconsistency this function exists to remove.+ --+ -- Reworked units already count as reported, so the new quantityComplete is+ -- the target MINUS them. Assigning the full target on top of a reworked unit+ -- would report more units than the operation ever produced (target 3 with 1+ -- complete + 1 reworked must end at 2 complete + 1 reworked, not 3 + 1).+ -- GREATEST never lowers a quantity the floor already reported.+ UPDATE "jobOperation" jo+ SET "quantityComplete" = GREATEST(+ COALESCE(t."quantityComplete", 0),+ p_quantity_complete - COALESCE(t."quantityReworked", 0)+ ),+ status = 'Done',+ "updatedBy" = COALESCE(p_user_id, jo."updatedBy", jo."createdBy"),+ "updatedAt" = NOW()+ FROM terminal_job_operations(p_job_id) t+ WHERE jo.id = t.id;+END;+$$;++-- These helpers take a bare job id and, being SECURITY DEFINER, bypass RLS.+-- Unlike complete_job_to_inventory they have no p_company_id to bind the call+-- to a tenant, so PostgreSQL's default PUBLIC EXECUTE grant would let any+-- authenticated user of any company read and close another tenant's+-- operations. They are internal helpers of complete_job_to_inventory (which+-- does enforce the company check), so revoke the API roles entirely.+REVOKE ALL ON FUNCTION terminal_job_operations(TEXT) FROM PUBLIC, anon, authenticated;+REVOKE ALL ON FUNCTION complete_job_remaining_quantities(TEXT, NUMERIC, TEXT) FROM PUBLIC, anon, authenticated;+++CREATE OR REPLACE FUNCTION complete_job_to_inventory(+ p_job_id TEXT,+ p_quantity_complete NUMERIC,+ p_storage_unit_id TEXT DEFAULT NULL,+ p_location_id TEXT DEFAULT NULL,+ p_company_id TEXT DEFAULT NULL,+ p_user_id TEXT DEFAULT NULL+)+RETURNS VOID+LANGUAGE plpgsql+SECURITY DEFINER+SET search_path = public+AS $$+DECLARE+ v_item_id TEXT;+ v_item_tracking_type "itemTrackingType";+ v_cogs_account TEXT;+ v_sales_order_line_id TEXT;+ v_line_quantity_complete NUMERIC;+ v_job_company_id TEXT;+ v_prior_quantity_received NUMERIC;+ v_quantity_received_to_inventory NUMERIC;+ v_job_id_readable TEXT;+ v_job_make_method RECORD;+ v_tracked_entity RECORD;+ v_accounting_enabled BOOLEAN;+ v_company_group_id TEXT;+ v_raw_materials_account TEXT;+ v_finished_goods_account TEXT;+ v_item_inventory_account TEXT;+ v_item_inventory_description TEXT;+ v_wip_account TEXT;+ v_labor_absorption_account TEXT;+ v_overhead_absorption_account TEXT;+ v_dimension_item_posting_group TEXT;+ v_dimension_item TEXT;+ v_dimension_location TEXT;+ v_dimension_cost_center TEXT;+ v_dimension_employee TEXT;+ v_event RECORD;+ v_duration_hours NUMERIC;+ v_rate NUMERIC;+ v_labor_cost NUMERIC;+ v_overhead_cost NUMERIC;+ v_event_reference TEXT;+ v_labor_journal_line_reference TEXT;+ v_labor_accounting_period_id TEXT;+ v_labor_journal_entry_id TEXT;+ v_labor_journal_id TEXT;+ v_labor_jl_id TEXT;+ v_accumulated_wip_cost NUMERIC;+ v_today DATE;+ v_journal_line_reference TEXT;+ v_accounting_period_id TEXT;+ v_journal_entry_id TEXT;+ v_journal_id TEXT;+ v_jl_ids TEXT[];+ v_new_per_unit_cost NUMERIC;+ v_costing_method TEXT;+ v_existing_unit_cost NUMERIC;+ v_item_posting_group_id TEXT;+ v_job_location_id TEXT;+ v_total_qty_on_hand NUMERIC;+ v_prior_qty NUMERIC;+ v_prior_value NUMERIC;+ v_new_unit_cost NUMERIC;+ v_serial_unit_ids TEXT[];+ v_company_today DATE := company_today(p_company_id);+BEGIN+ -- Never let a NULL user reach NOT NULL audit columns; fall back to the job creator+ p_user_id := COALESCE(p_user_id, (SELECT "createdBy" FROM "job" WHERE id = p_job_id));++ -- Fetch job details. The row lock makes a concurrent completion wait and then+ -- read this completion's cumulative quantity, so both cannot compute the same+ -- receipt delta.+ SELECT "itemId", "quantityReceivedToInventory", "jobId", "locationId", "salesOrderLineId", "companyId"+ INTO STRICT v_item_id, v_prior_quantity_received, v_job_id_readable, v_job_location_id, v_sales_order_line_id, v_job_company_id+ FROM "job"+ WHERE id = p_job_id+ FOR UPDATE;++ -- SECURITY DEFINER bypasses RLS: bind the call to the job's own company so a+ -- caller can never complete another tenant's job or post into a mismatched+ -- company's ledger/journal.+ IF p_company_id IS NULL OR v_job_company_id IS DISTINCT FROM p_company_id THEN+ RAISE EXCEPTION 'Job % does not belong to company %', p_job_id, COALESCE(p_company_id, '<null>');+ END IF;++ -- Non-Inventory items (services) never enter inventory+ SELECT "itemTrackingType"+ INTO v_item_tracking_type+ FROM "item"+ WHERE id = v_item_id+ AND "companyId" = p_company_id;++ -- A stocked item completed at zero marks the job Completed, receives nothing+ -- and backflushes nothing. Refuse it at the one function every completion path+ -- crosses (ERP complete route, API/MCP, sync_finish_job_operation).+ IF v_item_tracking_type IS DISTINCT FROM 'Non-Inventory'+ AND COALESCE(p_quantity_complete, 0) <= 0 THEN+ RAISE EXCEPTION 'Quantity completed must be greater than 0 for job %', v_job_id_readable;+ END IF;++ -- Delta for this completion: drives the itemLedger/costLedger quantities and+ -- the WIP-discharge journal. The job column itself stores the CUMULATIVE+ -- quantity (get_inventory_quantities computes on-production supply as+ -- production + scrap - received - shipped, which requires cumulative).+ v_quantity_received_to_inventory := p_quantity_complete - COALESCE(v_prior_quantity_received, 0);++ -- Fetch jobMakeMethod for the top-level (no parentMaterialId)+ SELECT *+ INTO STRICT v_job_make_method+ FROM "jobMakeMethod"+ WHERE "jobId" = p_job_id+ AND "parentMaterialId" IS NULL;++ -- Serial units are received one tracked entity at a time, so a fractional+ -- quantity cannot be honoured; it would be stored on the job and rounded by+ -- the receipt.+ IF v_job_make_method."requiresSerialTracking"+ AND p_quantity_complete <> trunc(p_quantity_complete) THEN+ RAISE EXCEPTION 'Quantity completed must be a whole number for serial-tracked job %', v_job_id_readable;+ END IF;++ -- The quantity is cumulative, so a stocked job cannot be completed at less than+ -- it has already received: the negative delta would post a negative receipt,+ -- cost layer and WIP journal. Received stock is corrected through inventory+ -- adjustments, not by re-completing the job. Non-Inventory jobs never receive.+ IF v_item_tracking_type IS DISTINCT FROM 'Non-Inventory'+ AND p_quantity_complete < COALESCE(v_prior_quantity_received, 0) THEN+ RAISE EXCEPTION 'Quantity completed cannot be lower than the % already received for job %',+ COALESCE(v_prior_quantity_received, 0), v_job_id_readable;+ END IF;++ -- Update job status. quantityReceivedToInventory is CUMULATIVE (not the+ -- delta): re-completions previously overwrote it with the delta, corrupting+ -- get_inventory_quantities' on-production supply math. Non-Inventory items+ -- never receive to inventory, so their value is left unchanged.+ UPDATE "job"+ SET status = 'Completed',+ "completedDate" = NOW(),+ "quantityComplete" = p_quantity_complete,+ "quantityReceivedToInventory" = CASE+ WHEN v_item_tracking_type = 'Non-Inventory' THEN v_prior_quantity_received+ ELSE p_quantity_complete+ END,+ "updatedAt" = NOW(),+ "updatedBy" = p_user_id+ WHERE id = p_job_id;++ -- Complete the quantities behind the status: raise the terminal operations so+ -- the routing agrees with a Completed job, and refuse a serial job whose units+ -- still need serial numbers.+ --+ -- AFTER the status flip, never before. Closing an operation fires+ -- sync_finish_job_operation, which re-enters this function for a job in+ -- Ready/In Progress/Paused. Being a BEFORE row trigger it runs mid-statement,+ -- so it reads the operation's OLD quantityComplete (still 0 on a desk+ -- completion), falls back to the job's planned quantity and receives a second+ -- time — while this call's own receipt delta was computed further up, before+ -- any of it happened. With the job already Completed the interceptor's status+ -- gate returns early, so the operations close without a second receipt.+ PERFORM complete_job_remaining_quantities(p_job_id, p_quantity_complete, p_user_id);++ -- Services never ship, so job completion is the fulfillment event: advance+ -- the linked sales-order line the way post-shipment does for physical lines.+ -- Lives HERE (not in app code) because completion has multiple entry points —+ -- the ERP complete route AND the sync_finish_job_operation interceptor that+ -- auto-completes when the last operation finishes. Recomputed from ALL jobs+ -- on the line, so it is idempotent and lot-split safe. Runs before the+ -- accounting-enabled / zero-WIP early returns.+ -- NARROWED: only genuine Service lines (salesOrderLineType = 'Service') fulfill+ -- by completion. They never receive a shipment line (the `create` edge fn skips+ -- salesOrderLineType='Service'), so completion is their only fulfillment event.+ -- A Non-Inventory *Part* (or Material/Tool/etc.) still ships via post-shipment and+ -- must NOT be auto-fulfilled here — that was marking SO lines "Shipped" with no shipment.+ IF v_item_tracking_type = 'Non-Inventory' AND v_sales_order_line_id IS NOT NULL+ AND EXISTS (+ SELECT 1 FROM "salesOrderLine" sol+ WHERE sol.id = v_sales_order_line_id+ AND sol."companyId" = p_company_id+ AND sol."salesOrderLineType" = 'Service'+ ) THEN+ SELECT COALESCE(SUM("quantityComplete"), 0)+ INTO v_line_quantity_complete+ FROM "job"+ WHERE "salesOrderLineId" = v_sales_order_line_id+ AND "companyId" = p_company_id+ AND status != 'Cancelled';++ UPDATE "salesOrderLine" sol+ SET "quantitySent" = v_line_quantity_complete,+ "sentComplete" = (COALESCE(sol."saleQuantity", 0) > 0 AND v_line_quantity_complete >= sol."saleQuantity"),+ "sentDate" = CASE+ WHEN COALESCE(sol."saleQuantity", 0) > 0+ AND v_line_quantity_complete >= sol."saleQuantity"+ AND sol."sentDate" IS NULL+ THEN v_company_today+ ELSE sol."sentDate"+ END,+ "updatedBy" = p_user_id,+ "updatedAt" = NOW()+ WHERE sol.id = v_sales_order_line_id+ AND sol."companyId" = p_company_id;+ END IF;++ -- Insert itemLedger entries based on tracking type.+ -- Non-Inventory items (services) never enter inventory, and a re-completion at+ -- the quantity already received has nothing new to receive.+ IF v_item_tracking_type IS DISTINCT FROM 'Non-Inventory'+ AND v_quantity_received_to_inventory > 0 THEN+ IF v_job_make_method."requiresBatchTracking" THEN+ SELECT *+ INTO v_tracked_entity+ FROM "trackedEntity"+ WHERE attributes->>'Job Make Method' = v_job_make_method.id+ AND "companyId" = p_company_id+ AND status != 'Consumed'+ ORDER BY "createdAt" DESC+ LIMIT 1;++ -- The job's own lot can already be Consumed by a lot MERGE: the batch+ -- completion prompt offers the merge before member jobs are received,+ -- and the merge is identity-only (it moves no unreceived stock). This+ -- job's receipt must then land on the merge's output lot — walk Merge+ -- activities from the job's lot to the terminal, still-live output.+ IF v_tracked_entity.id IS NULL THEN+ WITH RECURSIVE merge_walk(id) AS (+ SELECT te.id+ FROM "trackedEntity" te+ WHERE te.attributes->>'Job Make Method' = v_job_make_method.id+ AND te."companyId" = p_company_id+ UNION+ SELECT tao."trackedEntityId"+ FROM merge_walk+ JOIN "trackedActivityInput" tai+ ON tai."trackedEntityId" = merge_walk.id+ AND tai."companyId" = p_company_id+ JOIN "trackedActivity" ta+ ON ta.id = tai."trackedActivityId"+ AND ta."companyId" = p_company_id+ AND ta.type = 'Merge'+ JOIN "trackedActivityOutput" tao+ ON tao."trackedActivityId" = ta.id+ AND tao."companyId" = p_company_id+ )+ SELECT te.*+ INTO v_tracked_entity+ FROM merge_walk+ JOIN "trackedEntity" te ON te.id = merge_walk.id+ WHERE te.status != 'Consumed'+ ORDER BY te."createdAt" DESC+ LIMIT 1;+ END IF;++ IF v_tracked_entity.id IS NULL THEN+ RAISE EXCEPTION 'Tracked entity not found';+ END IF;++ INSERT INTO "itemLedger" (+ "entryType", "documentType", "documentId", "companyId",+ "itemId", quantity, "locationId", "storageUnitId",+ "trackedEntityId", "createdBy"+ ) VALUES (+ 'Assembly Output', 'Job Receipt', p_job_id, p_company_id,+ v_item_id, v_quantity_received_to_inventory, p_location_id, p_storage_unit_id,+ v_tracked_entity.id, p_user_id+ );++ ELSIF v_job_make_method."requiresSerialTracking" THEN+ -- Receive exactly the newly completed units: units finished on the shop floor+ -- (Available) first, then by serial number. A unit this job already received+ -- is never received again, so re-completion cannot double-count. Rejected+ -- (failed inspection) and Scrapped units never enter stock. The candidates+ -- are locked so a concurrent completion cannot take the same units.+ v_serial_unit_ids := ARRAY(+ SELECT te.id+ FROM "trackedEntity" te+ WHERE te.attributes->>'Job Make Method' = v_job_make_method.id+ AND te."companyId" = p_company_id+ AND te.status NOT IN ('Consumed', 'Rejected', 'Scrapped')+ AND te.quantity = 1+ AND NOT EXISTS (+ SELECT 1+ FROM "itemLedger" il+ WHERE il."trackedEntityId" = te.id+ AND il."documentType" = 'Job Receipt'+ AND il."documentId" = p_job_id+ )+ ORDER BY+ CASE te.status WHEN 'Available' THEN 0 WHEN 'Reserved' THEN 1 ELSE 2 END,+ te."readableId" NULLS LAST,+ te."createdAt",+ te.id+ FOR UPDATE OF te+ );++ IF COALESCE(array_length(v_serial_unit_ids, 1), 0) >= v_quantity_received_to_inventory THEN+ INSERT INTO "itemLedger" (+ "entryType", "documentType", "documentId", "companyId",+ "itemId", quantity, "locationId", "storageUnitId",+ "trackedEntityId", "createdBy"+ )+ SELECT+ 'Assembly Output', 'Job Receipt', p_job_id, p_company_id,+ v_item_id, 1, p_location_id, p_storage_unit_id,+ unit_id, p_user_id+ FROM unnest(v_serial_unit_ids[1:v_quantity_received_to_inventory::INTEGER]) AS unit_id;++ UPDATE "trackedEntity"+ SET status = 'Available'+ WHERE id = ANY(v_serial_unit_ids[1:v_quantity_received_to_inventory::INTEGER]);++ ELSE+ -- An item with no serial sequence never reaches assign-serial-numbers, so+ -- the job still holds ONE seed entity covering every unit and there is+ -- nothing to receive one at a time. Receive the delta against that seed,+ -- the way the batch branch does. Raising here instead would abort the+ -- jobOperation UPDATE itself: completion also runs inside+ -- sync_finish_job_operation, a BEFORE trigger interceptor.+ SELECT *+ INTO v_tracked_entity+ FROM "trackedEntity" te+ WHERE te.attributes->>'Job Make Method' = v_job_make_method.id+ AND te."companyId" = p_company_id+ AND te.status NOT IN ('Consumed', 'Rejected', 'Scrapped')+ AND te.quantity > 1+ ORDER BY te."createdAt"+ LIMIT 1+ FOR UPDATE;++ -- Genuinely short of units (some scrapped, some already received) rather+ -- than un-numbered: receiving fewer than completed would leave the job's+ -- received quantity ahead of the ledger.+ IF v_tracked_entity.id IS NULL THEN+ RAISE EXCEPTION 'Job % has % serial unit(s) left to receive, fewer than the % being completed',+ v_job_id_readable, COALESCE(array_length(v_serial_unit_ids, 1), 0), v_quantity_received_to_inventory;+ END IF;++ INSERT INTO "itemLedger" (+ "entryType", "documentType", "documentId", "companyId",+ "itemId", quantity, "locationId", "storageUnitId",+ "trackedEntityId", "createdBy"+ ) VALUES (+ 'Assembly Output', 'Job Receipt', p_job_id, p_company_id,+ v_item_id, v_quantity_received_to_inventory, p_location_id, p_storage_unit_id,+ v_tracked_entity.id, p_user_id+ );++ UPDATE "trackedEntity"+ SET status = 'Available'+ WHERE id = v_tracked_entity.id;+ END IF;++ ELSE+ INSERT INTO "itemLedger" (+ "entryType", "documentType", "documentId", "companyId",+ "itemId", quantity, "locationId", "storageUnitId", "createdBy"+ ) VALUES (+ 'Assembly Output', 'Job Receipt', p_job_id, p_company_id,+ v_item_id, v_quantity_received_to_inventory, p_location_id, p_storage_unit_id,+ p_user_id+ );+ END IF;+ END IF;++ -- Update pickMethod defaultStorageUnitId if needed+ IF v_item_tracking_type IS DISTINCT FROM 'Non-Inventory' AND p_storage_unit_id IS NOT NULL AND p_location_id IS NOT NULL THEN+ IF NOT EXISTS (+ SELECT 1 FROM "itemLedger"+ WHERE "itemId" = v_item_id+ AND "locationId" = p_location_id+ AND "storageUnitId" IS NOT NULL+ AND "storageUnitId" != p_storage_unit_id+ LIMIT 1+ ) THEN+ IF EXISTS (+ SELECT 1 FROM "pickMethod"+ WHERE "itemId" = v_item_id AND "locationId" = p_location_id+ ) THEN+ UPDATE "pickMethod"+ SET "defaultStorageUnitId" = p_storage_unit_id,+ "updatedBy" = p_user_id,+ "updatedAt" = NOW()+ WHERE "itemId" = v_item_id+ AND "locationId" = p_location_id;+ ELSE+ INSERT INTO "pickMethod" (+ "itemId", "locationId", "defaultStorageUnitId",+ "companyId", "createdBy", "createdAt"+ ) VALUES (+ v_item_id, p_location_id, p_storage_unit_id,+ p_company_id, p_user_id, NOW()+ );+ END IF;+ END IF;+ END IF;++ -- Backflush unissued materials (delegated to shared function)+ PERFORM backflush_job_materials(p_job_id, p_quantity_complete, p_company_id, p_user_id);++ -- Check if accounting is enabled+ SELECT "accountingEnabled"+ INTO v_accounting_enabled+ FROM "companySettings"+ WHERE id = p_company_id;++ v_accounting_enabled := COALESCE(v_accounting_enabled, false);++ IF NOT v_accounting_enabled THEN+ RETURN;+ END IF;++ -- Fetch company group+ SELECT "companyGroupId"+ INTO STRICT v_company_group_id+ FROM company+ WHERE id = p_company_id;++ -- Fetch account defaults+ SELECT "rawMaterialsAccount", "finishedGoodsAccount", "workInProgressAccount", "laborAbsorptionAccount", "overheadAbsorptionAccount", "costOfGoodsSoldAccount"+ INTO STRICT v_raw_materials_account, v_finished_goods_account, v_wip_account, v_labor_absorption_account, v_overhead_absorption_account, v_cogs_account+ FROM "accountDefault"+ WHERE "companyId" = p_company_id;++ -- Resolve Raw Materials vs Finished Goods from the produced item:+ -- Buy → Raw Materials; Make / Buy and Make → Finished Goods.+ SELECT+ CASE WHEN i."replenishmentSystem" = 'Buy' THEN v_raw_materials_account ELSE v_finished_goods_account END,+ CASE WHEN i."replenishmentSystem" = 'Buy' THEN 'Raw Materials Account' ELSE 'Finished Goods Account' END+ INTO v_item_inventory_account, v_item_inventory_description+ FROM "item" i+ WHERE i."id" = v_item_id+ AND i."companyId" = p_company_id;++ -- Non-Inventory (Service): the produced output is never stocked, so completion+ -- relieves WIP straight to Cost of Goods Sold (Epicor "Make Direct" pattern).+ -- >>> REV-REC SEAM (spec .ai/specs/2026-07-04-revenue-recognition.md, issue #1048):+ -- when revenue recognition lands, Percent-of-Completion elements will gate THIS+ -- branch off and post COGS as-incurred in the recognition run instead. <<<+ IF v_item_tracking_type = 'Non-Inventory' THEN+ v_item_inventory_account := v_cogs_account;+ v_item_inventory_description := 'Cost of Goods Sold';+ END IF;++ -- Fetch dimension IDs+ SELECT+ MAX(CASE WHEN "entityType" = 'ItemPostingGroup' THEN id END),+ MAX(CASE WHEN "entityType" = 'Item' THEN "id" END),+ MAX(CASE WHEN "entityType" = 'Location' THEN id END),+ MAX(CASE WHEN "entityType" = 'CostCenter' THEN id END),+ MAX(CASE WHEN "entityType" = 'Employee' THEN id END)+ INTO v_dimension_item_posting_group, v_dimension_item, v_dimension_location,+ v_dimension_cost_center, v_dimension_employee+ FROM dimension+ WHERE "companyGroupId" = v_company_group_id+ AND active = true+ AND "entityType" IN ('ItemPostingGroup', 'Item', 'Location', 'CostCenter', 'Employee');++ -- Post unposted production events as labor/machine + overhead absorption JEs+ -- (mirrors post-production-event; this is the catch-up path for events that+ -- were never posted individually)+ FOR v_event IN+ SELECT+ pe.id,+ pe.duration,+ pe.type,+ pe."employeeId",+ wc."laborRate",+ wc."machineRate",+ wc."overheadRate"+ FROM "productionEvent" pe+ INNER JOIN "jobOperation" jo ON jo.id = pe."jobOperationId"+ INNER JOIN "workCenter" wc ON wc.id = pe."workCenterId"+ WHERE jo."jobId" = p_job_id+ AND pe."endTime" IS NOT NULL+ AND pe."postedToGL" = false+ AND pe.duration > 0+ LOOP+ v_duration_hours := v_event.duration::NUMERIC / 3600;+ v_rate := CASE+ WHEN v_event.type = 'Machine' THEN COALESCE(v_event."machineRate", 0)+ ELSE COALESCE(v_event."laborRate", 0)+ END;+ v_labor_cost := v_duration_hours * v_rate;+ v_overhead_cost := v_duration_hours * COALESCE(v_event."overheadRate", 0);+ v_event_reference := 'production-event:' || v_event.id;++ IF (v_labor_cost > 0 AND v_labor_absorption_account IS NOT NULL)+ OR (v_overhead_cost > 0 AND v_overhead_absorption_account IS NOT NULL) THEN+ v_labor_journal_line_reference := nanoid();++ -- Get current accounting period+ SELECT id INTO v_labor_accounting_period_id+ FROM "accountingPeriod"+ WHERE "companyId" = p_company_id+ AND "startDate" <= v_company_today+ AND "endDate" >= v_company_today+ AND status = 'Active'+ LIMIT 1;++ IF v_labor_accounting_period_id IS NULL THEN+ UPDATE "accountingPeriod"+ SET status = 'Inactive'+ WHERE status = 'Active' AND "companyId" = p_company_id;++ UPDATE "accountingPeriod"+ SET status = 'Active'+ WHERE "companyId" = p_company_id+ AND "startDate" <= v_company_today+ AND "endDate" >= v_company_today+ RETURNING id INTO v_labor_accounting_period_id;++ IF v_labor_accounting_period_id IS NULL THEN+ INSERT INTO "accountingPeriod" (+ "startDate", "endDate", "companyId", status, "createdBy"+ ) VALUES (+ date_trunc('month', v_company_today)::DATE,+ (date_trunc('month', v_company_today) + INTERVAL '1 month' - INTERVAL '1 day')::DATE,+ p_company_id, 'Active', 'system'+ )+ RETURNING id INTO v_labor_accounting_period_id;+ END IF;+ END IF;++ v_labor_journal_entry_id := get_next_sequence('journalEntry', p_company_id);++ INSERT INTO journal (+ "journalEntryId", "accountingPeriodId", description,+ "postingDate", "companyId", "sourceType", status,+ "postedAt", "postedBy", "createdBy"+ ) VALUES (+ v_labor_journal_entry_id, v_labor_accounting_period_id,+ v_event.type || ' Time — Job ' || v_job_id_readable,+ v_company_today, p_company_id, 'Production Event', 'Posted',+ NOW(), p_user_id, p_user_id+ )+ RETURNING id INTO v_labor_journal_id;++ IF v_labor_cost > 0 AND v_labor_absorption_account IS NOT NULL THEN+ -- DR WIP (labor/machine)+ INSERT INTO "journalLine" (+ "journalId", "accountId", description, amount, quantity,+ "documentType", "documentId", "documentLineReference",+ "journalLineReference", "companyId"+ ) VALUES (+ v_labor_journal_id, v_wip_account, 'WIP Account',+ v_labor_cost, 1,+ 'Production Event', p_job_id, v_event_reference,+ v_labor_journal_line_reference, p_company_id+ )+ RETURNING id INTO v_labor_jl_id;++ -- Employee dimension on WIP line+ IF v_dimension_employee IS NOT NULL AND v_event."employeeId" IS NOT NULL THEN+ INSERT INTO "journalLineDimension" (+ "journalLineId", "dimensionId", "valueId", "companyId"+ ) VALUES (+ v_labor_jl_id, v_dimension_employee, v_event."employeeId", p_company_id+ );+ END IF;++ -- Item dimension on WIP line (the finished good this labor rolls into)+ IF v_dimension_item IS NOT NULL AND v_item_id IS NOT NULL THEN+ INSERT INTO "journalLineDimension" (+ "journalLineId", "dimensionId", "valueId", "companyId"+ ) VALUES (+ v_labor_jl_id, v_dimension_item, v_item_id, p_company_id+ );+ END IF;++ -- CR Labor/Machine Absorption+ INSERT INTO "journalLine" (+ "journalId", "accountId", description, amount, quantity,+ "documentType", "documentId", "documentLineReference",+ "journalLineReference", "companyId"+ ) VALUES (+ v_labor_journal_id, v_labor_absorption_account, 'Labor/Machine Absorption',+ -v_labor_cost, 1,+ 'Production Event', p_job_id, v_event_reference,+ v_labor_journal_line_reference, p_company_id+ )+ RETURNING id INTO v_labor_jl_id;++ -- Employee dimension on absorption line+ IF v_dimension_employee IS NOT NULL AND v_event."employeeId" IS NOT NULL THEN+ INSERT INTO "journalLineDimension" (+ "journalLineId", "dimensionId", "valueId", "companyId"+ ) VALUES (+ v_labor_jl_id, v_dimension_employee, v_event."employeeId", p_company_id+ );+ END IF;++ -- Item dimension on absorption line+ IF v_dimension_item IS NOT NULL AND v_item_id IS NOT NULL THEN+ INSERT INTO "journalLineDimension" (+ "journalLineId", "dimensionId", "valueId", "companyId"+ ) VALUES (+ v_labor_jl_id, v_dimension_item, v_item_id, p_company_id+ );+ END IF;+ END IF;++ IF v_overhead_cost > 0 AND v_overhead_absorption_account IS NOT NULL THEN+ -- DR WIP (overhead)+ INSERT INTO "journalLine" (+ "journalId", "accountId", description, amount, quantity,+ "documentType", "documentId", "documentLineReference",+ "journalLineReference", "companyId"+ ) VALUES (+ v_labor_journal_id, v_wip_account, 'WIP Account (Overhead)',+ v_overhead_cost, 1,+ 'Production Event', p_job_id, v_event_reference,+ v_labor_journal_line_reference, p_company_id+ )+ RETURNING id INTO v_labor_jl_id;++ -- Employee dimension on WIP overhead line+ IF v_dimension_employee IS NOT NULL AND v_event."employeeId" IS NOT NULL THEN+ INSERT INTO "journalLineDimension" (+ "journalLineId", "dimensionId", "valueId", "companyId"+ ) VALUES (+ v_labor_jl_id, v_dimension_employee, v_event."employeeId", p_company_id+ );+ END IF;++ -- Item dimension on WIP overhead line+ IF v_dimension_item IS NOT NULL AND v_item_id IS NOT NULL THEN+ INSERT INTO "journalLineDimension" (+ "journalLineId", "dimensionId", "valueId", "companyId"+ ) VALUES (+ v_labor_jl_id, v_dimension_item, v_item_id, p_company_id+ );+ END IF;++ -- CR Overhead Absorption+ INSERT INTO "journalLine" (+ "journalId", "accountId", description, amount, quantity,+ "documentType", "documentId", "documentLineReference",+ "journalLineReference", "companyId"+ ) VALUES (+ v_labor_journal_id, v_overhead_absorption_account, 'Overhead Absorption',+ -v_overhead_cost, 1,+ 'Production Event', p_job_id, v_event_reference,+ v_labor_journal_line_reference, p_company_id+ )+ RETURNING id INTO v_labor_jl_id;++ -- Employee dimension on overhead absorption line+ IF v_dimension_employee IS NOT NULL AND v_event."employeeId" IS NOT NULL THEN+ INSERT INTO "journalLineDimension" (+ "journalLineId", "dimensionId", "valueId", "companyId"+ ) VALUES (+ v_labor_jl_id, v_dimension_employee, v_event."employeeId", p_company_id+ );+ END IF;++ -- Item dimension on overhead absorption line+ IF v_dimension_item IS NOT NULL AND v_item_id IS NOT NULL THEN+ INSERT INTO "journalLineDimension" (+ "journalLineId", "dimensionId", "valueId", "companyId"+ ) VALUES (+ v_labor_jl_id, v_dimension_item, v_item_id, p_company_id+ );+ END IF;+ END IF;+ END IF;++ UPDATE "productionEvent"+ SET "postedToGL" = true+ WHERE id = v_event.id;+ END LOOP;++ -- Calculate accumulated WIP cost for this job+ SELECT COALESCE(ABS(SUM(jl.amount)), 0)+ INTO v_accumulated_wip_cost+ FROM "journalLine" jl+ INNER JOIN journal j ON j.id = jl."journalId"+ WHERE jl."accountId" = v_wip_account+ AND jl."documentId" = p_job_id+ AND j."companyId" = p_company_id;++ IF v_accumulated_wip_cost <= 0 THEN+ RETURN;+ END IF;++ -- A stocked re-completion at the quantity already received has no units to+ -- carry this cost. The catch-up WIP above stays in WIP and is discharged with+ -- the next receipt; the per-unit cost below would otherwise divide by zero.+ IF v_item_tracking_type IS DISTINCT FROM 'Non-Inventory'+ AND v_quantity_received_to_inventory <= 0 THEN+ RETURN;+ END IF;++ v_today := v_company_today;+ v_journal_line_reference := nanoid();++ -- Get accounting period for WIP discharge+ SELECT id INTO v_accounting_period_id+ FROM "accountingPeriod"+ WHERE "companyId" = p_company_id+ AND "startDate" <= v_today+ AND "endDate" >= v_today+ AND status = 'Active'+ LIMIT 1;++ IF v_accounting_period_id IS NULL THEN+ UPDATE "accountingPeriod"+ SET status = 'Inactive'+ WHERE status = 'Active' AND "companyId" = p_company_id;++ UPDATE "accountingPeriod"+ SET status = 'Active'+ WHERE "companyId" = p_company_id+ AND "startDate" <= v_today+ AND "endDate" >= v_today+ RETURNING id INTO v_accounting_period_id;++ IF v_accounting_period_id IS NULL THEN+ INSERT INTO "accountingPeriod" (+ "startDate", "endDate", "companyId", status, "createdBy"+ ) VALUES (+ date_trunc('month', v_today)::DATE,+ (date_trunc('month', v_today) + INTERVAL '1 month' - INTERVAL '1 day')::DATE,+ p_company_id, 'Active', 'system'+ )+ RETURNING id INTO v_accounting_period_id;+ END IF;+ END IF;++ v_journal_entry_id := get_next_sequence('journalEntry', p_company_id);++ INSERT INTO journal (+ "journalEntryId", "accountingPeriodId", description,+ "postingDate", "companyId", "sourceType", status,+ "postedAt", "postedBy", "createdBy"+ ) VALUES (+ v_journal_entry_id, v_accounting_period_id,+ 'Job Completion ' || v_job_id_readable,+ v_today, p_company_id, 'Job Receipt', 'Posted',+ NOW(), p_user_id, p_user_id+ )+ RETURNING id INTO v_journal_id;++ -- DR Inventory (Raw Materials or Finished Goods by item)+ INSERT INTO "journalLine" (+ "journalId", "accountId", description, amount, quantity,+ "documentType", "documentId", "documentLineReference",+ "journalLineReference", "companyId"+ ) VALUES (+ v_journal_id, v_item_inventory_account, v_item_inventory_description,+ v_accumulated_wip_cost, v_quantity_received_to_inventory,+ 'Job Receipt', p_job_id, 'job:' || p_job_id,+ v_journal_line_reference, p_company_id+ )+ RETURNING id INTO v_labor_jl_id;++ v_jl_ids := ARRAY[v_labor_jl_id];++ -- CR WIP+ INSERT INTO "journalLine" (+ "journalId", "accountId", description, amount, quantity,+ "documentType", "documentId", "documentLineReference",+ "journalLineReference", "companyId"+ ) VALUES (+ v_journal_id, v_wip_account, 'WIP Account',+ -v_accumulated_wip_cost, v_quantity_received_to_inventory,+ 'Job Receipt', p_job_id, 'job:' || p_job_id,+ v_journal_line_reference, p_company_id+ )+ RETURNING id INTO v_labor_jl_id;++ v_jl_ids := v_jl_ids || v_labor_jl_id;++ -- Write costLedger entry for finished good (skipped for Non-Inventory: no+ -- output layer exists for a service — its cost went straight to COGS above)+ IF v_item_tracking_type IS DISTINCT FROM 'Non-Inventory' THEN+ INSERT INTO "costLedger" (+ "itemLedgerType", "costLedgerType", adjustment,+ "documentType", "documentId", "itemId",+ quantity, cost, "remainingQuantity", "companyId"+ ) VALUES (+ 'Output', 'Direct Cost', false,+ 'Job Receipt', p_job_id, v_item_id,+ v_quantity_received_to_inventory, v_accumulated_wip_cost,+ v_quantity_received_to_inventory, p_company_id+ );+ END IF;++ -- Update item cost+ SELECT "costingMethod", "unitCost", "itemPostingGroupId"+ INTO v_costing_method, v_existing_unit_cost, v_item_posting_group_id+ FROM "itemCost"+ WHERE "itemId" = v_item_id+ AND "companyId" = p_company_id;++ -- Update itemCost.unitCost (skipped for Non-Inventory: a service has no+ -- stocked unit cost; the read above still feeds the dimension inserts below)+ IF v_item_tracking_type IS DISTINCT FROM 'Non-Inventory' THEN+ v_new_per_unit_cost := v_accumulated_wip_cost / v_quantity_received_to_inventory;++ IF v_costing_method = 'Average' THEN+ SELECT COALESCE(SUM(quantity), 0)+ INTO v_total_qty_on_hand+ FROM "itemLedger"+ WHERE "itemId" = v_item_id+ AND "companyId" = p_company_id;++ v_prior_qty := v_total_qty_on_hand - v_quantity_received_to_inventory;+ v_prior_value := v_prior_qty * COALESCE(v_existing_unit_cost, 0);++ IF v_total_qty_on_hand > 0 THEN+ v_new_unit_cost := (v_prior_value + v_accumulated_wip_cost) / v_total_qty_on_hand;+ UPDATE "itemCost"+ SET "unitCost" = v_new_unit_cost+ WHERE "itemId" = v_item_id+ AND "companyId" = p_company_id;+ END IF;++ ELSIF v_costing_method IN ('FIFO', 'LIFO') THEN+ UPDATE "itemCost"+ SET "unitCost" = v_new_per_unit_cost+ WHERE "itemId" = v_item_id+ AND "companyId" = p_company_id;+ END IF;+ END IF;++ -- Insert dimensions on WIP discharge journal lines+ IF v_jl_ids IS NOT NULL AND array_length(v_jl_ids, 1) > 0 THEN+ FOR i IN 1..array_length(v_jl_ids, 1)+ LOOP+ IF v_item_posting_group_id IS NOT NULL AND v_dimension_item_posting_group IS NOT NULL THEN+ INSERT INTO "journalLineDimension" (+ "journalLineId", "dimensionId", "valueId", "companyId"+ ) VALUES (+ v_jl_ids[i], v_dimension_item_posting_group, v_item_posting_group_id, p_company_id+ );+ END IF;++ IF v_dimension_item IS NOT NULL AND v_item_id IS NOT NULL THEN+ INSERT INTO "journalLineDimension" (+ "journalLineId", "dimensionId", "valueId", "companyId"+ ) VALUES (+ v_jl_ids[i], v_dimension_item, v_item_id, p_company_id+ );+ END IF;++ IF v_job_location_id IS NOT NULL AND v_dimension_location IS NOT NULL THEN+ INSERT INTO "journalLineDimension" (+ "journalLineId", "dimensionId", "valueId", "companyId"+ ) VALUES (+ v_jl_ids[i], v_dimension_location, v_job_location_id, p_company_id+ );+ END IF;+ END LOOP;+ END IF;+END;+$$;diff --git a/packages/database/supabase/tests/job-completion-operation-quantities.test.sql b/packages/database/supabase/tests/job-completion-operation-quantities.test.sqlnew file mode 100644index 0000000000..a15eb03d13--- /dev/null+++ b/packages/database/supabase/tests/job-completion-operation-quantities.test.sql@@ -0,0 +1,319 @@+-- Marking a job complete completes its operations' quantities+-- (complete_job_to_inventory -> complete_job_remaining_quantities).+-- Isolated fixture company; no existing business data is read or edited. Always rolls back.+-- Run: pnpm exec tsx scripts/run-local-accounting-check.ts psql -X -f packages/database/supabase/tests/job-completion-operation-quantities.test.sql+\set ON_ERROR_STOP on+BEGIN;+SET LOCAL statement_timeout = '60s';++-- A job for p_item_id with p_quantity units, consuming 2 of p_part_id per unit.+-- Serial items keep their placeholder split into numbered single units, as the+-- item serial sequence does at job creation.+CREATE FUNCTION pg_temp.make_job(+ p_company_id text, p_location_id text, p_item_id text, p_part_id text,+ p_readable_id text, p_quantity numeric+) RETURNS text LANGUAGE plpgsql AS $fn$+DECLARE+ v_job_id text;+ v_make_method_id text;+ v_seed record;+BEGIN+ INSERT INTO job ("jobId", "itemId", quantity, "locationId", "companyId", "createdBy", "unitOfMeasureCode")+ VALUES (p_readable_id, p_item_id, p_quantity, p_location_id, p_company_id, 'system', 'EA')+ RETURNING id INTO v_job_id;++ SELECT id INTO STRICT v_make_method_id+ FROM "jobMakeMethod" WHERE "jobId" = v_job_id AND "parentMaterialId" IS NULL;++ INSERT INTO "jobMaterial" ("jobId", "jobMakeMethodId", "itemId", description, "methodType",+ "itemType", quantity, "estimatedQuantity", "companyId", "createdBy")+ VALUES (v_job_id, v_make_method_id, p_part_id, 'Stocked part', 'Pull from Inventory',+ 'Part', 2, 2 * p_quantity, p_company_id, 'system');++ SELECT * INTO v_seed FROM "trackedEntity" WHERE attributes->>'Job Make Method' = v_make_method_id;+ IF v_seed.id IS NOT NULL THEN+ UPDATE "trackedEntity" SET quantity = 1, "readableId" = p_readable_id || '-01' WHERE id = v_seed.id;+ FOR n IN 2..p_quantity::int LOOP+ INSERT INTO "trackedEntity" ("sourceDocument", "sourceDocumentId", "sourceDocumentReadableId",+ quantity, status, "companyId", "createdBy", attributes, "itemId", "readableId")+ VALUES (v_seed."sourceDocument", v_seed."sourceDocumentId", v_seed."sourceDocumentReadableId",+ 1, 'Reserved', p_company_id, 'system', v_seed.attributes, v_seed."itemId",+ p_readable_id || '-' || lpad(n::text, 2, '0'));+ END LOOP;+ END IF;++ RETURN v_job_id;+END;+$fn$;++-- Adds an operation to the job's top-level make method, or to a sub-assembly+-- make method when p_parent_material_id is given.+CREATE FUNCTION pg_temp.add_operation(+ p_job_id text, p_company_id text, p_process_id text, p_work_center_id text,+ p_quantity numeric, p_order int, p_make_method_id text DEFAULT NULL+) RETURNS text LANGUAGE plpgsql AS $fn$+DECLARE v_operation text; v_make_method text;+BEGIN+ v_make_method := COALESCE(p_make_method_id,+ (SELECT id FROM "jobMakeMethod" WHERE "jobId" = p_job_id AND "parentMaterialId" IS NULL));++ INSERT INTO "jobOperation" ("jobId", "jobMakeMethodId", "processId", "workCenterId",+ "operationQuantity", "targetQuantity", "order", status, "companyId", "createdBy")+ VALUES (p_job_id, v_make_method, p_process_id, p_work_center_id,+ p_quantity, p_quantity, p_order, 'Ready', p_company_id, 'system')+ RETURNING id INTO v_operation;++ RETURN v_operation;+END;+$fn$;++CREATE FUNCTION pg_temp.try_complete(p_job_id text, p_quantity numeric) RETURNS text+LANGUAGE plpgsql AS $fn$+DECLARE v_job record;+BEGIN+ SELECT * INTO STRICT v_job FROM job WHERE id = p_job_id;+ PERFORM complete_job_to_inventory(p_job_id, p_quantity, NULL, v_job."locationId", v_job."companyId", 'system');+ RETURN NULL;+EXCEPTION WHEN OTHERS THEN+ RETURN SQLERRM;+END;+$fn$;++CREATE FUNCTION pg_temp.try_finish_operation(p_operation_id text) RETURNS text+LANGUAGE plpgsql AS $fn$+BEGIN+ UPDATE "jobOperation" SET status = 'Done', "updatedBy" = 'system' WHERE id = p_operation_id;+ RETURN NULL;+EXCEPTION WHEN OTHERS THEN+ RETURN SQLERRM;+END;+$fn$;++-- "<status>:<quantityComplete>" per operation, in routing order.+CREATE FUNCTION pg_temp.ops(p_job_id text) RETURNS text LANGUAGE sql AS $fn$+ SELECT string_agg(jo.status || ':' || jo."quantityComplete"::numeric,+ ',' ORDER BY jo."order", jo.id)+ FROM "jobOperation" jo+ JOIN "jobMakeMethod" m ON m.id = jo."jobMakeMethodId"+ WHERE jo."jobId" = p_job_id AND m."parentMaterialId" IS NULL;+$fn$;++-- Production quantity rows recorded against the job. A desk completion must+-- fabricate none: it is not shop-floor production.+CREATE FUNCTION pg_temp.production_rows(p_job_id text) RETURNS int LANGUAGE sql AS $fn$+ SELECT count(*)::int FROM "productionQuantity" pq+ JOIN "jobOperation" jo ON jo.id = pq."jobOperationId"+ WHERE jo."jobId" = p_job_id;+$fn$;++CREATE FUNCTION pg_temp.receipts(p_job_id text) RETURNS text LANGUAGE sql AS $fn$+ SELECT count(*)::text || ':' || COALESCE(sum(quantity), 0)::numeric::text+ FROM "itemLedger"+ WHERE "documentId" = p_job_id AND "documentType" = 'Job Receipt';+$fn$;++DO $cases$+DECLARE+ v_group_id text; v_company_id text; v_location_id text;+ v_serial_item text; v_stocked_item text; v_part text;+ v_job text; v_error text; v_row record;+ v_process text; v_work_center text; v_op1 text; v_op2 text; v_sub_op text;+ v_sub_method text; v_sub_material text;+BEGIN+ INSERT INTO "companyGroup" (name, "createdBy") VALUES ('Job op quantities test', 'system') RETURNING id INTO v_group_id;+ INSERT INTO company (name, "companyGroupId", "baseCurrencyCode", timezone)+ VALUES ('Job op quantities test', v_group_id, 'USD', 'UTC') RETURNING id INTO v_company_id;+ INSERT INTO location (name, "addressLine1", city, "postalCode", "companyId", "createdBy", timezone)+ VALUES ('Plant', '1 Test Way', 'Testville', '00000', v_company_id, 'system', 'UTC') RETURNING id INTO v_location_id;+ INSERT INTO "unitOfMeasure" (code, name, "companyId", "createdBy")+ VALUES ('EA', 'Each', v_company_id, 'system') ON CONFLICT DO NOTHING;+ INSERT INTO item ("readableId", name, type, "replenishmentSystem", "itemTrackingType", "unitOfMeasureCode", "companyId", "createdBy")+ VALUES ('T-STOCKED', 'Stocked assembly', 'Part', 'Make', 'Inventory', 'EA', v_company_id, 'system') RETURNING id INTO v_stocked_item;+ INSERT INTO item ("readableId", name, type, "replenishmentSystem", "itemTrackingType", "unitOfMeasureCode", "companyId", "createdBy")+ VALUES ('T-SERIAL', 'Serial machine', 'Part', 'Make', 'Serial', 'EA', v_company_id, 'system') RETURNING id INTO v_serial_item;+ INSERT INTO item ("readableId", name, type, "replenishmentSystem", "itemTrackingType", "unitOfMeasureCode", "companyId", "createdBy")+ VALUES ('T-PART', 'Stocked part', 'Part', 'Buy', 'Inventory', 'EA', v_company_id, 'system') RETURNING id INTO v_part;++ INSERT INTO process (name, "processType", "defaultStandardFactor", "companyId", "createdBy")+ VALUES ('Assembly', 'Process', 'Hours/Piece', v_company_id, 'system') RETURNING id INTO v_process;+ INSERT INTO "workCenter" (name, "locationId", "laborRate", "machineRate", "overheadRate", "defaultStandardFactor", "companyId", "createdBy")+ VALUES ('Bench', v_location_id, 0, 0, 0, 'Hours/Piece', v_company_id, 'system') RETURNING id INTO v_work_center;++ -- THE BUG: completing a job left every operation at 0, so the routing stayed+ -- open behind a Completed status.+ v_job := pg_temp.make_job(v_company_id, v_location_id, v_stocked_item, v_part, 'QJ', 2);+ v_op1 := pg_temp.add_operation(v_job, v_company_id, v_process, v_work_center, 2, 1);+ v_op2 := pg_temp.add_operation(v_job, v_company_id, v_process, v_work_center, 2, 2);++ ASSERT pg_temp.ops(v_job) = 'Ready:0,Ready:0',+ 'Operations did not start open: ' || pg_temp.ops(v_job);++ v_error := pg_temp.try_complete(v_job, 2);+ ASSERT v_error IS NULL, 'Completing the job failed: ' || COALESCE(v_error, '');++ SELECT status, "quantityComplete" INTO v_row FROM job WHERE id = v_job;+ ASSERT v_row.status = 'Completed' AND v_row."quantityComplete" = 2,+ 'Job header wrong after completion: ' || v_row.status || ' @ ' || v_row."quantityComplete";+ ASSERT pg_temp.ops(v_job) = 'Done:2,Done:2',+ 'Operations did not complete with the job: ' || pg_temp.ops(v_job);+ ASSERT pg_temp.receipts(v_job) = '1:2',+ 'Expected one receipt of 2: ' || pg_temp.receipts(v_job);+ ASSERT pg_temp.production_rows(v_job) = 0,+ 'A desk completion must not fabricate production history';++ -- Re-completing at the same cumulative quantity changes nothing.+ v_error := pg_temp.try_complete(v_job, 2);+ ASSERT v_error IS NULL, 'Re-completion failed: ' || COALESCE(v_error, '');+ ASSERT pg_temp.receipts(v_job) = '1:2',+ 'Re-completion received again: ' || pg_temp.receipts(v_job);+ ASSERT pg_temp.ops(v_job) = 'Done:2,Done:2',+ 'Re-completion disturbed the operations: ' || pg_temp.ops(v_job);++ -- An operation the floor already reported past the completed quantity keeps+ -- its own higher count; the backfill only ever raises a shortfall.+ v_job := pg_temp.make_job(v_company_id, v_location_id, v_stocked_item, v_part, 'PJ', 2);+ v_op1 := pg_temp.add_operation(v_job, v_company_id, v_process, v_work_center, 2, 1);+ v_op2 := pg_temp.add_operation(v_job, v_company_id, v_process, v_work_center, 2, 2);+ UPDATE "jobOperation" SET "quantityComplete" = 5 WHERE id = v_op1;++ v_error := pg_temp.try_complete(v_job, 2);+ ASSERT v_error IS NULL, 'Completing with an over-reported operation failed: ' || COALESCE(v_error, '');+ -- Its higher reported quantity is preserved, but it still closes: an+ -- operation that meets its target is Done by the same rule the interceptor+ -- applies, so leaving it Ready on a Completed job would be inconsistent.+ ASSERT pg_temp.ops(v_job) = 'Done:5,Done:2',+ 'A satisfied operation must close without losing its quantity: ' || pg_temp.ops(v_job);++ -- Reworked units already count as reported, so closing must not stack the+ -- full target on top of them and report more units than were ever produced.+ v_job := pg_temp.make_job(v_company_id, v_location_id, v_stocked_item, v_part, 'RWJ', 3);+ v_op1 := pg_temp.add_operation(v_job, v_company_id, v_process, v_work_center, 3, 1);+ UPDATE "jobOperation" SET "quantityComplete" = 1, "quantityReworked" = 1 WHERE id = v_op1;++ v_error := pg_temp.try_complete(v_job, 3);+ ASSERT v_error IS NULL, 'Completing with a reworked unit failed: ' || COALESCE(v_error, '');+ SELECT "quantityComplete", "quantityReworked" INTO v_row FROM "jobOperation" WHERE id = v_op1;+ ASSERT v_row."quantityComplete" + v_row."quantityReworked" = 3,+ 'Reported units must equal the completed quantity, got '+ || v_row."quantityComplete" || ' complete + ' || v_row."quantityReworked" || ' reworked';++ -- Sub-assembly operations are NOT completed: they build a different item, and+ -- ticking them would claim work that may never have happened.+ v_job := pg_temp.make_job(v_company_id, v_location_id, v_stocked_item, v_part, 'SUBJ', 1);+ v_op1 := pg_temp.add_operation(v_job, v_company_id, v_process, v_work_center, 1, 1);++ INSERT INTO "jobMaterial" ("jobId", "jobMakeMethodId", "itemId", description, "methodType",+ "itemType", quantity, "estimatedQuantity", "companyId", "createdBy")+ SELECT v_job, m.id, v_part, 'Made sub-assembly', 'Make to Order', 'Part', 1, 1, v_company_id, 'system'+ FROM "jobMakeMethod" m WHERE m."jobId" = v_job AND m."parentMaterialId" IS NULL+ RETURNING id INTO v_sub_material;+ INSERT INTO "jobMakeMethod" ("jobId", "parentMaterialId", "itemId", "quantityPerParent", "companyId", "createdBy")+ VALUES (v_job, v_sub_material, v_part, 1, v_company_id, 'system')+ RETURNING id INTO v_sub_method;+ v_sub_op := pg_temp.add_operation(v_job, v_company_id, v_process, v_work_center, 1, 1, v_sub_method);++ v_error := pg_temp.try_complete(v_job, 1);+ ASSERT v_error IS NULL, 'Completing a job with a sub-assembly failed: ' || COALESCE(v_error, '');+ SELECT status, "quantityComplete" INTO v_row FROM "jobOperation" WHERE id = v_sub_op;+ ASSERT v_row.status <> 'Done' AND v_row."quantityComplete" = 0,+ 'A sub-assembly operation must not be completed by the job: ' || v_row.status || ' @ ' || v_row."quantityComplete";++ -- Serial job with units still outstanding is refused, and nothing is applied.+ v_job := pg_temp.make_job(v_company_id, v_location_id, v_serial_item, v_part, 'SJ', 3);+ v_op1 := pg_temp.add_operation(v_job, v_company_id, v_process, v_work_center, 3, 1);++ v_error := pg_temp.try_complete(v_job, 3);+ ASSERT v_error LIKE '%serial number is required%',+ 'Serial job with outstanding units was not refused: ' || COALESCE(v_error, '<succeeded>');+ SELECT status INTO v_row FROM job WHERE id = v_job;+ ASSERT v_row.status <> 'Completed', 'A refused serial completion still completed the job';+ ASSERT pg_temp.ops(v_job) = 'Ready:0',+ 'A refused serial completion still wrote quantities: ' || pg_temp.ops(v_job);++ -- The same serial job completes once the floor has reported every unit.+ UPDATE "jobOperation" SET "quantityComplete" = 3 WHERE id = v_op1;+ v_error := pg_temp.try_complete(v_job, 3);+ ASSERT v_error IS NULL, 'Serial job finished in MES failed to complete: ' || COALESCE(v_error, '');+ SELECT status, "quantityComplete" INTO v_row FROM job WHERE id = v_job;+ ASSERT v_row.status = 'Completed' AND v_row."quantityComplete" = 3,+ 'Serial job did not complete after MES reported every unit';++ -- REGRESSION: a RELEASED job must receive exactly once.+ --+ -- Every case above runs on a Draft job (the column default), and+ -- sync_finish_job_operation ignores Draft jobs outside a batch — so none of+ -- them exercise the interceptor at all. On a Ready/In Progress/Paused job,+ -- closing the operations re-enters complete_job_to_inventory through that+ -- BEFORE trigger; closing them before the status flip received the goods a+ -- second time (2 receipts / 4 units on this case).+ v_job := pg_temp.make_job(v_company_id, v_location_id, v_stocked_item, v_part, 'RELJ', 2);+ v_op1 := pg_temp.add_operation(v_job, v_company_id, v_process, v_work_center, 2, 1);+ UPDATE job SET status = 'Ready' WHERE id = v_job;++ v_error := pg_temp.try_complete(v_job, 2);+ ASSERT v_error IS NULL, 'Completing a released job failed: ' || COALESCE(v_error, '');+ SELECT status, "quantityComplete", "quantityReceivedToInventory" INTO v_row FROM job WHERE id = v_job;+ ASSERT v_row.status = 'Completed' AND v_row."quantityComplete" = 2,+ 'Released job header wrong: ' || v_row.status || ' @ ' || v_row."quantityComplete";+ ASSERT v_row."quantityReceivedToInventory" = 2,+ 'Released job received quantity wrong: ' || v_row."quantityReceivedToInventory";+ ASSERT pg_temp.ops(v_job) = 'Done:2',+ 'Released job operations did not close: ' || pg_temp.ops(v_job);+ ASSERT pg_temp.receipts(v_job) = '1:2',+ 'A released desk completion must receive exactly once: ' || pg_temp.receipts(v_job);++ -- Same job, completed SHORT: one receipt of 1, not 1 + a planned-quantity+ -- fallback receipt of 2. The interceptor reads the operation's pre-update+ -- quantity, so a re-entry here would fall back to the job's planned quantity.+ v_job := pg_temp.make_job(v_company_id, v_location_id, v_stocked_item, v_part, 'RELSJ', 2);+ v_op1 := pg_temp.add_operation(v_job, v_company_id, v_process, v_work_center, 2, 1);+ UPDATE job SET status = 'Ready' WHERE id = v_job;++ v_error := pg_temp.try_complete(v_job, 1);+ ASSERT v_error IS NULL, 'Completing a released job short failed: ' || COALESCE(v_error, '');+ ASSERT pg_temp.receipts(v_job) = '1:1',+ 'A short released completion must receive exactly its quantity: ' || pg_temp.receipts(v_job);+ ASSERT pg_temp.ops(v_job) = 'Done:1',+ 'A short released completion left the routing open: ' || pg_temp.ops(v_job);++ -- An In Progress job whose floor already reported part of the run: the desk+ -- completes the remainder, and the goods are received once for the whole+ -- cumulative quantity.+ v_job := pg_temp.make_job(v_company_id, v_location_id, v_stocked_item, v_part, 'IPJ', 2);+ v_op1 := pg_temp.add_operation(v_job, v_company_id, v_process, v_work_center, 2, 1);+ v_op2 := pg_temp.add_operation(v_job, v_company_id, v_process, v_work_center, 2, 2);+ UPDATE "jobOperation" SET "quantityComplete" = 1 WHERE id = v_op2;+ UPDATE job SET status = 'In Progress' WHERE id = v_job;++ v_error := pg_temp.try_complete(v_job, 2);+ ASSERT v_error IS NULL, 'Completing an in-progress job failed: ' || COALESCE(v_error, '');+ ASSERT pg_temp.receipts(v_job) = '1:2',+ 'An in-progress desk completion must receive exactly once: ' || pg_temp.receipts(v_job);+ ASSERT pg_temp.ops(v_job) = 'Done:2,Done:2',+ 'An in-progress desk completion left the routing open: ' || pg_temp.ops(v_job);+ ASSERT pg_temp.production_rows(v_job) = 0,+ 'A desk completion on a released job must not fabricate production history';++ -- MES path: finishing the last operation completes the job through the+ -- sync_finish_job_operation interceptor. The backfill must stay out of it —+ -- writing a sibling jobOperation row from that BEFORE trigger is impossible.+ v_job := pg_temp.make_job(v_company_id, v_location_id, v_stocked_item, v_part, 'MJ', 2);+ v_op1 := pg_temp.add_operation(v_job, v_company_id, v_process, v_work_center, 2, 1);+ v_op2 := pg_temp.add_operation(v_job, v_company_id, v_process, v_work_center, 2, 2);+ UPDATE job SET status = 'In Progress' WHERE id = v_job;++ v_error := pg_temp.try_finish_operation(v_op1);+ ASSERT v_error IS NULL, 'Finishing the first operation failed: ' || COALESCE(v_error, '');+ v_error := pg_temp.try_finish_operation(v_op2);+ ASSERT v_error IS NULL, 'Finishing the last operation failed: ' || COALESCE(v_error, '');++ SELECT status INTO v_row FROM job WHERE id = v_job;+ ASSERT v_row.status = 'Completed', 'MES completion did not complete the job: ' || v_row.status;+ ASSERT pg_temp.receipts(v_job) = '1:2',+ 'MES completion did not receive exactly once: ' || pg_temp.receipts(v_job);++ RAISE NOTICE 'ALL OPERATION-QUANTITY CASES PASSED (backfill, idempotent re-completion, no lowering, sub-assemblies untouched, serial refusal and release, no fabricated production history, released/in-progress single receipt, MES trigger path)';+END;+$cases$;++ROLLBACK;diff --git a/packages/jobs/manifests/schema.json b/packages/jobs/manifests/schema.jsonindex ffa773169b..13ba2d609c 100644--- a/packages/jobs/manifests/schema.json+++ b/packages/jobs/manifests/schema.json@@ -1,11 +1,11 @@{"kind": "carbon-company-backup","version": 1,- "schemaVersion": "20260918132911",+ "schemaVersion": "20260922050131","sourceCompanyId": "schema-baseline","sourceCompanyGroupId": null,"sourceCompanyName": null,- "exportedAt": "2026-09-19T17:17:38.334Z",+ "exportedAt": "2026-09-22T07:16:49.167Z","exportedBy": "schema-baseline","label": "schema baseline","includeStorage": "none",@@ -129,59 +129,59 @@"id","endingBalanceDate","companyId",- "updatedAt",- "createdAt"+ "createdAt",+ "updatedAt"]},{"name": "accountingSyncOperation","rows": 0,"columns": [- "completedAt",- "updatedAt",- "entityId",+ "direction",+ "lastAttemptAt",+ "id",+ "idempotencyKey",+ "attemptCount",+ "status",+ "companyId",+ "errorCode",+ "metadata","createdBy","externalId",- "integration",- "errorMessage",- "entityType",+ "updatedAt",+ "completedAt",+ "entityId",+ "trigger","createdAt","updatedBy",- "trigger",- "idempotencyKey",- "id",- "lastAttemptAt",- "direction",- "metadata",- "companyId",- "errorCode",- "status",- "attemptCount"+ "entityType",+ "errorMessage",+ "integration"]},{"name": "accountingSyncTieOut","rows": 0,"columns": [- "docBackedAmount",- "pendingAmount",- "createdBy",- "internalDelta",- "companyId",- "carbonPostedAmount","excludedAmount","id","blockedAmount",- "syncedAmount",- "integration",+ "carbonPostedAmount",+ "createdBy",+ "internalDelta",+ "companyId",+ "docBackedAmount",+ "pendingAmount",+ "accountId",+ "providerAmount",+ "computedAt",+ "createdAt","externalDelta",+ "integration","accountingPeriodId","updatedAt","updatedBy",- "computedAt",- "createdAt",- "accountId",- "providerAmount"+ "syncedAmount"]},{@@ -204,15 +204,15 @@"name": "agentThread","rows": 0,"columns": [- "title","userId",+ "title","createdBy","modelId","companyId","updatedAt","createdAt",- "id","updatedBy",+ "id","lastContext"]},@@ -220,231 +220,232 @@"name": "agentMessage","rows": 0,"columns": [- "outputTokens",- "finishReason",- "updatedBy",- "threadId","feedback",- "createdBy",- "id","inputTokens",+ "id",+ "createdBy",+ "finishReason",+ "outputTokens",+ "threadId",+ "updatedBy",+ "createdAt",+ "context","feedbackNote",- "role",- "companyId","updatedAt",- "context",- "createdAt"+ "companyId",+ "role"]},{"name": "agentMessagePart","rows": 0,"columns": [- "toolName",+ "toolOutput",+ "id",+ "toolCallId",+ "textContent",+ "toolDurationMs",+ "messageId",+ "createdAt",+ "toolInput",+ "toolClassification",+ "type",+ "toolState",+ "createdBy",+ "updatedBy","updatedAt",+ "orderIndex","errorMessage","companyId",- "orderIndex",- "updatedBy",- "createdBy",- "toolState",- "type",- "toolInput",- "toolClassification",- "messageId",- "toolDurationMs",- "createdAt",- "textContent",- "toolOutput",- "toolCallId",- "id"+ "toolName"]},{"name": "approvalRequest","rows": 0,"columns": [- "requestedAt",- "documentId",- "createdAt",- "status",- "updatedBy",- "amount",- "companyId",- "decisionAt",- "createdBy",- "documentType",- "updatedAt","requestedBy",- "decisionNotes","decisionBy",- "id"+ "id",+ "decisionNotes",+ "decisionAt",+ "updatedAt",+ "documentType",+ "createdBy",+ "updatedBy",+ "companyId",+ "amount",+ "requestedAt",+ "createdAt",+ "documentId",+ "status"]},{"name": "approvalRule","rows": 0,"columns": [+ "createdAt",+ "companyId",+ "documentType","lowerBoundAmount","updatedBy","createdBy","id",- "createdAt",- "companyId",- "documentType",- "defaultApproverId",- "updatedAt","escalationDays","enabled",- "approverGroupIds"+ "approverGroupIds",+ "updatedAt",+ "defaultApproverId"]},{"name": "auditLogArchive","rows": 0,"columns": [+ "endDate",+ "archivePath",+ "startDate",+ "sizeBytes","id","rowCount","companyId",- "createdAt",- "endDate",- "startDate",- "archivePath",- "sizeBytes"+ "createdAt"]},{"name": "changeOrderRequiredAction","rows": 0,"columns": [- "companyId",- "updatedAt",- "id",- "customFields",- "createdAt",+ "updatedBy","active","name",- "updatedBy",- "createdBy"+ "createdBy",+ "updatedAt",+ "companyId",+ "createdAt",+ "id",+ "customFields"]},{"name": "changeOrderType","rows": 0,"columns": [- "companyId",- "createdAt",- "updatedBy",- "createdBy",- "name","id",- "updatedAt"+ "updatedAt",+ "name",+ "createdBy",+ "createdAt",+ "companyId",+ "updatedBy"]},{"name": "companyAccountsPayableBillingAddress","rows": 0,"columns": [- "fax",- "countryCode",- "updatedBy",- "name",- "state","email","phone","id",- "postalCode",+ "state",+ "name",+ "updatedBy",+ "fax",+ "countryCode",+ "updatedAt",+ "city","addressLine1","addressLine2",- "city",- "updatedAt"+ "postalCode"]},{"name": "companyAccountsReceivableBillingAddress","rows": 0,"columns": [+ "updatedAt",+ "city","postalCode",- "addressLine2","addressLine1",- "city",- "updatedAt",- "countryCode",- "fax",- "updatedBy",- "name",+ "addressLine2","state",- "id",+ "email","phone",- "email"+ "id",+ "fax",+ "countryCode",+ "name",+ "updatedBy"]},{"name": "companySettings","rows": 0,"columns": [- "productLabelSize","showCustomerReadableId",- "plmReleaseControl",- "id",- "salesJobCompletedNotificationGroup",- "autoStartOperationTimer",+ "productLabelSize","enforceInspectionFourEyes",- "requireMfa",+ "showCurrencyTrailingZeros","updateLeadTimesOnReceipt",- "accountsPayableEmail",- "salesRuleNotificationGroup",+ "allowLowercaseItemIds","useMetric",- "returnPickedMaterialTiming",- "accountingEnabled",- "accountsReceivableAddress",- "inventoryJobCompletedNotificationGroup",- "accountsPayableAddress",+ "accountsPayableEmail",+ "salesJobCompletedNotificationGroup",+ "plmReleaseControl",+ "includeOperationsOnTraveler",+ "id",+ "autoStartOperationTimer","includeMaterialsOnTraveler","materialGeneratedIds","qualityIssueTarget",- "inventoryShelfLife",- "incompletePickingListPolicy",+ "accountingEnabled",+ "returnPickedMaterialTiming",+ "accountsPayableAddress",+ "accountsReceivableAddress",+ "inventoryJobCompletedNotificationGroup","gaugeCalibrationExpiredNotificationGroup","digitalQuoteEnabled","consoleEnabled",- "assetTaxDepreciationEnabled",+ "inventoryShelfLife",+ "incompletePickingListPolicy","otherDispatchNotificationGroup",- "allowLowercaseItemIds",+ "requireMfa","supplierQuoteNotificationGroup",- "assetTaxRate",- "defaultSupplierCc",+ "assetTaxDepreciationEnabled","rfqReadyNotificationGroup",- "operationsDispatchNotificationGroup","kanbanOutput","quoteLineCategoryMarkups",- "defaultCustomerCc",- "printing",- "showCurrencyTrailingZeros",+ "operationsDispatchNotificationGroup",+ "assetTaxRate",+ "defaultSupplierCc","shelfLabelSize","timeCardEnabled",+ "defaultCustomerCc",+ "printing",+ "salesRuleNotificationGroup","accountsReceivableEmail",- "digitalQuoteIncludesPurchaseOrders",- "purchasePriceUpdateTiming",- "digitalQuoteNotificationGroup",- "autoSelectMaterialWithoutPickingList",- "showSupplierReadableId","qualityDispatchNotificationGroup",+ "showSupplierReadableId","maintenanceDispatchNotificationGroup",- "samplingStandard"+ "samplingStandard",+ "purchasePriceUpdateTiming",+ "digitalQuoteNotificationGroup",+ "digitalQuoteIncludesPurchaseOrders",+ "autoSelectMaterialWithoutPickingList"]},{"name": "companyUsage","rows": 0,"columns": [- "users","updatedAt",- "id",+ "users","companyId",+ "id",+ "createdAt","aiTokens","tasks",- "createdAt","nextResetDatetime"]},@@ -486,16 +487,16 @@"name": "costCenter","rows": 0,"columns": [- "customFields",- "id",- "createdAt",- "name",- "ownerId",- "updatedAt",- "createdBy",- "parentCostCenterId",+ "updatedBy","companyId",- "updatedBy"+ "parentCostCenterId",+ "createdBy",+ "updatedAt",+ "ownerId",+ "name",+ "createdAt",+ "id",+ "customFields"]},{@@ -591,8 +592,8 @@"status","periodEnd","postedAt",- "createdAt","updatedBy",+ "createdAt","depreciationRunId","postedBy","id",@@ -603,30 +604,30 @@"name": "dimension","rows": 0,"columns": [- "active",- "createdBy",- "entityType",- "companyGroupId",- "required",- "updatedBy",- "id",+ "name","updatedAt","createdAt",- "name"+ "id",+ "updatedBy",+ "required",+ "companyGroupId",+ "entityType",+ "createdBy",+ "active"]},{"name": "dimensionValue","rows": 0,"columns": [- "updatedBy",- "companyGroupId",- "name",- "createdBy",- "updatedAt","dimensionId",+ "updatedAt",+ "id","createdAt",- "id"+ "companyGroupId",+ "name",+ "updatedBy",+ "createdBy"]},{@@ -655,12 +656,6 @@"name": "documentExtraction","rows": 0,"columns": [- "storagePath",- "createdAt",- "sourceDocument",- "updatedAt",- "sourceDocumentId",- "status","filteredData","id","createdBy",@@ -668,7 +663,13 @@"updatedBy","companyId","extractedData",- "error"+ "error",+ "storagePath",+ "createdAt",+ "sourceDocument",+ "updatedAt",+ "sourceDocumentId",+ "status"]},{@@ -685,33 +686,33 @@"name": "documentSection","rows": 0,"columns": [- "content",- "placement",- "name",- "createdBy",+ "companyId",+ "updatedAt",+ "createdAt","id","updatedBy","config",- "companyId",- "updatedAt",- "createdAt"+ "placement",+ "name",+ "createdBy",+ "content"]},{"name": "documentTemplate","rows": 0,"columns": [- "formatVersion","documentType",+ "formatVersion","settings",- "updatedBy","blocks",- "companyId",+ "updatedBy","updatedAt",+ "companyId","headerSectionId","createdBy",- "id","footerSectionId",+ "id","createdAt","theme"]@@ -750,110 +751,110 @@"name": "employeeTypePermission","rows": 0,"columns": [- "update",- "create",- "delete",- "createdAt",- "employeeTypeId",- "view",+ "updatedAt","module",- "updatedAt"+ "view",+ "employeeTypeId",+ "createdAt",+ "delete",+ "create",+ "update"]},{"name": "enforcementRule","rows": 0,"columns": [- "message",- "appliesToAll",- "id",- "surfaces",- "targetType",- "conditionAst",- "companyId",- "filteredItemGroupIds",- "createdBy",- "createdAt",- "active",+ "description","customFields","filteredItemTypes",- "description",- "severity",- "updatedBy",+ "active",+ "createdAt","updatedAt",+ "updatedBy","name","family",- "filteredItemMatchAll"+ "filteredItemMatchAll",+ "severity",+ "appliesToAll",+ "id",+ "surfaces",+ "message",+ "filteredItemGroupIds",+ "companyId",+ "createdBy",+ "targetType",+ "conditionAst"]},{"name": "enforcementRuleAcknowledgment","rows": 0,"columns": [+ "message",+ "id",+ "severity",+ "documentId",+ "companyId",+ "createdAt",+ "outcome",+ "itemId","createdBy","documentType",- "documentLineId","ruleName","ruleId","updatedBy",- "documentId",- "id",- "severity",- "message",- "itemId",- "outcome",- "companyId",- "createdAt"+ "documentLineId"]},{"name": "eventSystemSubscription","rows": 0,"columns": [- "handlerType",- "table",- "companyId",- "operations",+ "name","active","config",- "name",- "filter","createdAt",- "id"+ "id",+ "filter",+ "companyId",+ "table",+ "handlerType",+ "operations"]},{"name": "exchangeRateOverride","rows": 0,"columns": [- "rate",- "currencyCode","updatedBy",+ "currencyCode",+ "rate","createdBy",- "companyId","updatedAt",- "id",- "createdAt"+ "companyId",+ "createdAt",+ "id"]},{"name": "externalIntegrationMapping","rows": 0,"columns": [- "entityId",- "updatedBy",- "integration",- "metadata",- "externalId",- "createdBy",- "companyId","entityType",+ "companyId","createdAt","lastSyncedAt","updatedAt",- "remoteUpdatedAt","id",- "allowDuplicateExternalId"+ "remoteUpdatedAt",+ "allowDuplicateExternalId",+ "integration",+ "entityId",+ "updatedBy",+ "metadata",+ "createdBy",+ "externalId"]},{@@ -865,45 +866,45 @@"name": "fixedAssetClass","rows": 0,"columns": [- "updatedAt",- "usefulLifeMonths",- "lossOnDisposalAccountId",- "createdAt",- "taxResidualValuePercent",- "createdBy",- "macrsConvention",- "taxUsefulLifeMonths",- "description",- "depreciationMethod",- "companyId",- "bonusDepreciationPercent",- "assetAccountId",- "updatedBy",- "depreciationExpenseAccountId",- "id",- "writeDownAccountId",- "residualValuePercent",- "gainOnDisposalAccountId",+ "accumulatedDepreciationAccountId",+ "customFields",+ "writeOffAccountId","macrsPropertyClass","taxDepreciationMethod","name",- "accumulatedDepreciationAccountId",- "customFields",- "writeOffAccountId"+ "residualValuePercent",+ "gainOnDisposalAccountId",+ "id",+ "depreciationExpenseAccountId",+ "writeDownAccountId",+ "updatedBy",+ "assetAccountId",+ "depreciationMethod",+ "description",+ "taxUsefulLifeMonths",+ "companyId",+ "bonusDepreciationPercent",+ "createdBy",+ "taxResidualValuePercent",+ "macrsConvention",+ "updatedAt",+ "usefulLifeMonths",+ "createdAt",+ "lossOnDisposalAccountId"]},{"name": "gaugeType","rows": 0,"columns": [- "customFields",- "companyId",- "updatedAt",- "createdAt","name","updatedBy","id",- "createdBy"+ "createdBy",+ "customFields",+ "companyId",+ "updatedAt",+ "createdAt"]},{@@ -943,29 +944,29 @@"name": "implementationCheckState","rows": 0,"columns": [- "createdBy",- "id",- "updatedAt",- "updatedBy",- "companyId",- "value","createdAt","kind",- "itemKey"+ "itemKey",+ "value",+ "updatedBy",+ "companyId",+ "createdBy",+ "id",+ "updatedAt"]},{"name": "implementationFieldValue","rows": 0,"columns": [- "createdAt","id",- "updatedAt",+ "createdAt","companyId",+ "updatedAt","createdBy",- "updatedBy","value",- "fieldKey"+ "fieldKey",+ "updatedBy"]},{@@ -973,47 +974,39 @@"rows": 0,"columns": ["sortOrder",- "createdAt",- "collection","payload",- "createdBy",- "updatedAt",+ "collection",+ "createdAt","id",- "updatedBy",- "companyId"+ "updatedAt",+ "createdBy",+ "companyId",+ "updatedBy"]},{"name": "invite","rows": 0,"columns": [- "revokedAt",- "createdAt",- "attestedAt",- "code",- "companyId",- "updatedBy",- "id",- "acceptedAt",+ "role",+ "attestedBy","createdBy",- "permissions","email",- "role",- "attestedBy"+ "permissions",+ "companyId",+ "acceptedAt",+ "id",+ "updatedBy",+ "createdAt",+ "revokedAt",+ "attestedAt",+ "code"]},{"name": "itarCertification","rows": 0,"columns": [- "docVersion",- "userAgent",- "createdAt",- "updatedAt",- "userId",- "type",- "createdBy",- "fullLegalName","id","complianceContact","ipAddress",@@ -1022,7 +1015,15 @@"expiresAt","companyId","title",- "certifiedAt"+ "certifiedAt",+ "docVersion",+ "userAgent",+ "createdAt",+ "updatedAt",+ "userId",+ "createdBy",+ "type",+ "fullLegalName"]},{@@ -1045,7 +1046,7 @@{"name": "itemStockQuantities","rows": 0,- "columns": ["locationId", "quantityOnHand", "itemId", "companyId"]+ "columns": ["quantityOnHand", "locationId", "itemId", "companyId"]},{"name": "journal",@@ -1102,48 +1103,48 @@"name": "intercompanyTransaction","rows": 0,"columns": [+ "updatedAt","status","sourceJournalLineId",- "updatedAt",+ "amount","targetCompanyId","sourceCompanyId","createdAt",- "amount",+ "targetJournalLineId","id","description","documentId",- "targetJournalLineId",- "companyGroupId",- "eliminationJournalId","currencyCode",- "documentType"+ "documentType",+ "companyGroupId",+ "eliminationJournalId"]},{"name": "intercompanyEliminationLine","rows": 0,"columns": [+ "journalLineId",+ "updatedBy",+ "role",+ "intercompanyTransactionId",+ "amount","id","quantity","createdAt","accountId",- "companyId","updatedAt",+ "companyId","itemId",- "createdBy",- "updatedBy",- "journalLineId",- "role",- "intercompanyTransactionId",- "amount"+ "createdBy"]},{"name": "journalLineDimension","rows": 0,"columns": [- "createdAt","id",+ "createdAt","journalLineId","companyId","dimensionId",@@ -1180,121 +1181,121 @@"name": "fixedAsset","rows": 0,"columns": [- "disposalMethod",- "serialNumber",- "companyId",- "taxDepreciationMethod",- "id",- "usefulLifeMonths",- "disposalDate",- "customFields",- "residualValuePercent",- "updatedAt",- "depreciationMethod",- "createdBy",- "taxResidualValuePercent",- "fixedAssetId",- "bonusDepreciationPercent",- "macrsConvention",- "accumulatedTaxDepreciation",- "saleProceeds",- "acquisitionCost",- "description",+ "name",+ "fixedAssetClassId",+ "macrsPropertyClass",+ "acquisitionDate",+ "depreciationStartDate",+ "createdAt",+ "locationId",+ "status",+ "notes",+ "assetLifetimeUsage","accumulatedDepreciation","updatedBy","taxUsefulLifeMonths",- "assetLifetimeUsage",- "notes",- "locationId",- "status",- "createdAt",- "depreciationStartDate",- "acquisitionDate",- "name",- "macrsPropertyClass",- "fixedAssetClassId"+ "description",+ "saleProceeds",+ "acquisitionCost",+ "macrsConvention",+ "accumulatedTaxDepreciation",+ "bonusDepreciationPercent",+ "fixedAssetId",+ "taxResidualValuePercent",+ "depreciationMethod",+ "updatedAt",+ "createdBy",+ "customFields",+ "residualValuePercent",+ "disposalDate",+ "id",+ "usefulLifeMonths",+ "companyId",+ "taxDepreciationMethod",+ "serialNumber",+ "disposalMethod"]},{"name": "depreciationRunLine","rows": 0,"columns": [- "journalId",- "id",- "depreciationRunId",- "taxAmount",- "companyId","fixedAssetId",- "amount"+ "amount",+ "companyId",+ "taxAmount",+ "depreciationRunId",+ "id",+ "journalId"]},{"name": "fixedAssetDisposal","rows": 0,"columns": [- "gainLoss",- "disposalDate",- "disposalMethod",- "updatedBy",- "saleProceeds",+ "netBookValueAtDisposal",+ "companyId",+ "id",+ "createdBy","journalId","createdAt","fixedAssetId",- "netBookValueAtDisposal",- "id",- "companyId",- "createdBy"+ "updatedBy",+ "saleProceeds",+ "gainLoss",+ "disposalMethod",+ "disposalDate"]},{"name": "fixedAssetUsageLog","rows": 0,"columns": [- "createdAt",- "periodStart",- "periodEnd",- "unitsProduced",- "createdBy","fixedAssetId",- "companyId",+ "createdBy","updatedBy",- "id"+ "id",+ "companyId",+ "periodStart",+ "periodEnd",+ "createdAt",+ "unitsProduced"]},{"name": "inventoryCount","rows": 0,"columns": [- "locationId",- "updatedBy",- "inventoryCountId",- "scope",- "createdBy",- "status",- "updatedAt",+ "customFields","companyId","createdAt",- "customFields",- "postedBy","snapshotAt",- "postedAt",- "id",+ "postedBy","notes",- "isBlind"+ "id",+ "postedAt",+ "isBlind",+ "inventoryCountId",+ "updatedBy",+ "locationId",+ "scope",+ "createdBy",+ "status",+ "updatedAt"]},{"name": "maintenanceFailureMode","rows": 0,"columns": [- "updatedBy",- "id",- "type",- "name",- "createdAt",- "updatedAt",+ "companyId","createdBy",- "companyId"+ "updatedAt",+ "createdAt",+ "name",+ "type",+ "id",+ "updatedBy"]},{@@ -1316,7 +1317,7 @@{"name": "materialDimension","rows": 0,- "columns": ["isMetric", "name", "companyId", "materialFormId", "id"]+ "columns": ["id", "materialFormId", "companyId", "name", "isMetric"]},{"name": "materialSubstance",@@ -1337,23 +1338,23 @@{"name": "materialFinish","rows": 0,- "columns": ["companyId", "materialSubstanceId", "id", "name"]+ "columns": ["materialSubstanceId", "companyId", "name", "id"]},{"name": "materialGrade","rows": 0,- "columns": ["id", "materialSubstanceId", "companyId", "name"]+ "columns": ["name", "companyId", "id", "materialSubstanceId"]},{"name": "materialType","rows": 0,"columns": [- "id",- "companyId",- "name",- "materialFormId",+ "materialSubstanceId","code",- "materialSubstanceId"+ "materialFormId",+ "name",+ "id",+ "companyId"]},{@@ -1417,17 +1418,17 @@"name": "assemblyPlanJob","rows": 0,"columns": [- "modelUploadId",- "createdAt",- "companyId",+ "planPath",+ "error",+ "status",+ "kind",+ "stats","updatedAt","id","createdBy",- "stats",- "status",- "kind",- "error",- "planPath"+ "createdAt",+ "companyId",+ "modelUploadId"]},{@@ -1435,55 +1436,48 @@"rows": 0,"columns": ["createdBy",+ "updatedAt","createdAt","companyId",- "updatedAt",- "id","updatedBy",- "name",- "customFields"+ "id",+ "customFields",+ "name"]},{"name": "nonConformanceRequiredAction","rows": 0,"columns": [- "createdAt",- "updatedAt",- "name",- "active","createdBy",- "systemType","id",+ "systemType","updatedBy",- "companyId"+ "companyId",+ "createdAt",+ "updatedAt",+ "active",+ "name"]},{"name": "nonConformanceType","rows": 0,"columns": [- "id","updatedAt",- "name",+ "id","customFields",+ "name","createdBy",+ "updatedBy","createdAt",- "companyId",- "updatedBy"+ "companyId"]},{"name": "nonConformanceWorkflow","rows": 0,"columns": [- "priority",- "companyId",- "updatedAt",- "content",- "description",- "createdBy",- "requiredActionIds","id","approvalRequirements","tags",@@ -1491,127 +1485,134 @@"updatedBy","createdAt","name",- "active"+ "active",+ "priority",+ "companyId",+ "updatedAt",+ "content",+ "description",+ "createdBy",+ "requiredActionIds"]},{"name": "nonConformance","rows": 0,"columns": [+ "id",+ "updatedBy",+ "nonConformanceWorkflowId",+ "status",+ "createdBy",+ "dueDate",+ "nonConformanceId",+ "locationId",+ "requiredActionIds",+ "approvalRequirements",+ "createdAt",+ "tags","assignee","content","source",- "tags","updatedAt","closeDate",- "customFields","openDate",- "quantity",+ "customFields","description","nonConformanceTypeId","name",+ "quantity","companyId",- "priority",- "updatedBy",- "nonConformanceWorkflowId",- "id",- "createdBy",- "status",- "nonConformanceId",- "locationId",- "dueDate",- "approvalRequirements",- "createdAt",- "requiredActionIds"+ "priority"]},{"name": "changeOrder","rows": 0,"columns": [- "reasonForChange",+ "priority",+ "updatedBy",+ "nonConformanceId",+ "sourceId",+ "requiredActionIds",+ "changeOrderId",+ "type",+ "changeOrderTypeId",+ "id",+ "openDate",+ "status",+ "updatedAt","name","approvalRequirements",- "customFields",+ "reasonForChange","tags",- "updatedAt",- "status",+ "customFields",+ "sourceType",+ "createdAt",+ "assignee","createdBy",- "companyId",- "dueDate","description",- "assignee",- "createdAt",- "sourceType",- "sourceId",- "changeOrderId",- "requiredActionIds",- "priority",- "nonConformanceId",- "updatedBy",- "id",- "changeOrderTypeId",- "openDate",- "type"+ "dueDate",+ "companyId"]},{"name": "changeOrderActionTask","rows": 0,"columns": [- "completedDate",- "companyId",- "id",- "sortOrder",- "tags",- "notes",- "createdBy",- "changeOrderId",- "actionTypeId",+ "assignee",+ "name",+ "updatedAt",+ "status","updatedBy","dueDate","createdAt",- "assignee",- "status",- "updatedAt",- "name"+ "notes",+ "tags",+ "actionTypeId",+ "createdBy",+ "changeOrderId",+ "completedDate",+ "sortOrder",+ "id",+ "companyId"]},{"name": "nonConformanceApprovalTask","rows": 0,"columns": [+ "createdAt",+ "dueDate",+ "updatedBy","status","updatedAt","approvalType","assignee",- "createdAt",- "dueDate",- "updatedBy",+ "id",+ "sortOrder",+ "companyId",+ "completedDate","nonConformanceId","createdBy",- "tags","notes",- "companyId",- "id",- "sortOrder",- "completedDate"+ "tags"]},{"name": "nonConformanceReviewer","rows": 0,"columns": [- "title",- "createdAt","updatedAt",+ "createdAt",+ "title",+ "assignee",+ "updatedBy","createdBy","id",- "updatedBy",- "assignee",+ "companyId","status","nonConformanceId",- "companyId","notes","completedDate"]@@ -1636,21 +1637,21 @@"name": "notification","rows": 0,"columns": [- "documentType",- "id",- "payload",- "title","seenAt","userId","from","documentId",+ "id",+ "documentType",+ "payload",+ "title",+ "topic",+ "companyId",+ "digestedInto",+ "description","event","readAt",- "createdAt",- "digestedInto",- "companyId",- "topic",- "description"+ "createdAt"]},{@@ -1658,44 +1659,44 @@"rows": 0,"columns": ["documentId",+ "lastDeliveryId","event","userId",- "lastDeliveryId",+ "successCount","id","createdAt",- "successCount",- "companyId",- "lastDeliveredAt"+ "lastDeliveredAt",+ "companyId"]},{"name": "notificationPreference","rows": 0,"columns": [+ "topic","updatedAt","companyId","channel",- "topic",- "userId","enabled",- "id"+ "id",+ "userId"]},{"name": "oauthCode","rows": 0,"columns": [- "redirectUri",- "id",- "codeChallenge",- "scope",- "expiresAt",- "codeChallengeMethod",- "code","companyId",- "createdAt",+ "clientId","userId",- "clientId"+ "createdAt",+ "scope",+ "codeChallenge",+ "id",+ "redirectUri",+ "code",+ "codeChallengeMethod",+ "expiresAt"]},{@@ -1740,22 +1741,22 @@"name": "periodCloseTaskDefinition","rows": 0,"columns": [- "severity",- "isSystem",- "customFields",- "companyId",- "createdAt",- "sortOrder",- "id",- "active",- "defaultAssigneeId",- "required",+ "createdBy",+ "autoCheckKey",+ "updatedAt","taskType","name","updatedBy",- "updatedAt",- "createdBy",- "autoCheckKey"+ "required",+ "id",+ "active",+ "defaultAssigneeId",+ "sortOrder",+ "customFields",+ "companyId",+ "createdAt",+ "severity",+ "isSystem"]},{@@ -1763,45 +1764,45 @@"rows": 0,"columns": ["taskType",- "status",- "required","id",- "severity",+ "required",+ "status","sortOrder",- "completedBy",- "companyId",+ "severity","evidenceJournalId",- "updatedAt",- "skippedReason",+ "companyId",+ "completedBy","notes",- "name",- "assigneeId",+ "skippedReason",+ "updatedAt","updatedBy",+ "assigneeId",+ "name","autoCheckKey",- "createdAt",- "createdBy",- "completedAt",+ "definitionId","accountingPeriodId",- "definitionId"+ "completedAt",+ "createdBy",+ "createdAt"]},{"name": "pickingList","rows": 0,"columns": [+ "notes",+ "status",+ "locationId",+ "assignee",+ "updatedAt","createdAt","companyId","customFields","pickingListId","dueDate","updatedBy",- "id","createdBy",- "notes",- "locationId",- "status",- "assignee",- "updatedAt"+ "id"]},{@@ -1809,24 +1810,24 @@"rows": 0,"columns": ["itemIds",- "customerIds","id",+ "customerIds","priority",- "validFrom","name",+ "validFrom","customerTypeIds","maxQuantity",- "amount",- "itemPostingGroupId","createdAt",+ "itemPostingGroupId",+ "amount","updatedAt",- "updatedBy","active",- "createdBy",+ "updatedBy","companyId",- "validTo",- "ruleType",+ "createdBy","amountType",+ "ruleType",+ "validTo","minQuantity"]},@@ -1834,64 +1835,64 @@"name": "printJob","rows": 0,"columns": [- "attempts",- "companyId",- "updatedAt","description","sourceDocumentId",- "origin",- "sourceDocumentReadableId",- "id",+ "companyId",+ "attempts",+ "updatedAt","printerUrl",+ "origin",+ "id",+ "sourceDocumentReadableId",+ "sourceDocument","completedAt",+ "contentType","status","createdBy",- "contentType",- "sourceDocument",- "content",- "error",+ "updatedBy","createdAt",- "updatedBy"+ "error",+ "content"]},{"name": "printerRoute","rows": 0,"columns": [- "name",+ "format","locationId",+ "name","printerUrl",- "format",- "companyId",- "updatedAt",- "apiKey","templateId",- "id","createdAt",- "mediaSizeId"+ "id",+ "mediaSizeId",+ "companyId",+ "updatedAt",+ "apiKey"]},{"name": "process","rows": 0,"columns": [- "active",- "name",- "batchType",- "processType",- "updatedBy",+ "createdBy","tags","updatedAt","id",- "createdBy",- "defaultStandardFactor",- "requiresAbility",- "companyId",- "createdAt",- "customFields",- "completeAllOnScan",+ "processType",+ "updatedBy",+ "name",+ "active",+ "batchType",+ "batchRules","batchable",- "batchRules"+ "completeAllOnScan",+ "customFields",+ "createdAt",+ "requiresAbility",+ "defaultStandardFactor",+ "companyId"]},{@@ -1915,70 +1916,85 @@"name": "employeeAbility","rows": 0,"columns": [+ "expiresAt",+ "id","companyId","employeeId",- "id",- "expiresAt",- "abilityId",- "lastTrainingDate"+ "lastTrainingDate",+ "abilityId"]},{"name": "procedure","rows": 0,"columns": [- "processId",+ "version",+ "updatedAt","tags",+ "processId","description","content",- "version",- "updatedAt",- "updatedBy",- "name",- "createdAt",- "assignee","createdBy","companyId","id",- "status"+ "status",+ "updatedBy",+ "name",+ "createdAt",+ "assignee"]},{"name": "procedureParameter","rows": 0,"columns": [- "createdAt",+ "companyId",+ "value",+ "key",+ "createdBy","id","updatedBy",- "updatedAt",+ "createdAt","procedureId",+ "updatedAt"+ ]+ },+ {+ "name": "project",+ "rows": 0,+ "columns": [+ "name",+ "description",+ "createdAt",+ "active","companyId",- "createdBy",- "value",- "key"+ "updatedBy",+ "updatedAt",+ "id",+ "createdBy"]},{"name": "purchasingRfq","rows": 0,"columns": [+ "expirationDate",+ "createdAt",+ "revisionId",+ "status","createdBy","updatedBy","employeeId","companyId",- "expirationDate",- "status",- "revisionId",- "createdAt",- "rfqDate",- "assignee",- "id",- "notes",- "locationId","internalNotes",+ "locationId",+ "updatedAt","customFields","rfqId",- "updatedAt"+ "rfqDate",+ "notes",+ "id",+ "assignee"]},{@@ -1990,84 +2006,84 @@"name": "qualityDocument","rows": 0,"columns": [- "status",- "updatedBy","assignee","version","description",- "content",- "updatedAt",- "id",- "createdAt",+ "updatedBy",+ "status","createdBy","companyId",+ "name","tags",- "name"+ "content",+ "updatedAt",+ "id",+ "createdAt"]},{"name": "reportPin","rows": 0,"columns": [+ "updatedBy","companyId","pinned",- "updatedBy","createdBy",- "userId","updatedAt",- "reportKey",- "createdAt"+ "userId",+ "createdAt",+ "reportKey"]},{"name": "reportView","rows": 0,"columns": [- "id",+ "config",+ "reportKey",+ "name",+ "createdBy","updatedBy",+ "id","visibility","companyId",- "updatedAt","createdAt",- "config",- "name",- "reportKey",- "createdBy"+ "updatedAt"]},{"name": "returnReason","rows": 0,"columns": [- "createdAt",+ "createdBy",+ "inventoryValueZero",+ "companyId",+ "updatedBy","customFields","id",- "updatedAt",+ "createdAt","name",- "createdBy",- "updatedBy",- "inventoryValueZero",- "companyId"+ "updatedAt"]},{"name": "scrapReason","rows": 0,"columns": [- "updatedAt",- "companyId",- "createdAt",- "createdBy",- "customFields","name",+ "customFields",+ "id","updatedBy",- "id"+ "companyId",+ "createdAt",+ "updatedAt",+ "createdBy"]},{"name": "searchIndexRegistry","rows": 0,- "columns": ["lastRebuiltAt", "createdAt", "companyId"]+ "columns": ["lastRebuiltAt", "companyId", "createdAt"]},{"name": "sequence",@@ -2157,16 +2173,16 @@"name": "peopleAbsence","rows": 0,"columns": [- "shiftId",- "employeeId",- "date",- "createdBy",+ "companyId",+ "updatedAt",+ "createdAt","updatedBy","id","note",- "companyId",- "createdAt",- "updatedAt"+ "employeeId",+ "date",+ "createdBy",+ "shiftId"]},{@@ -2208,31 +2224,31 @@"rows": 0,"columns": ["createdAt",- "documentType","documentId",+ "documentType","channelId",- "createdBy","updatedBy",+ "createdBy","companyId","threadTs",- "updatedAt",- "id"+ "id",+ "updatedAt"]},{"name": "ssoConnection","rows": 0,"columns": [- "metadataUrl","providerId",+ "metadataUrl","requireSso","metadataXml","companyId",- "createdBy","updatedBy",- "id",- "createdAt",+ "createdBy","updatedAt",+ "createdAt",+ "id","active"]},@@ -2241,36 +2257,36 @@"rows": 0,"columns": ["verifiedAt",- "domain","connectionId",+ "domain","verificationToken",- "createdBy","updatedBy",+ "createdBy","companyId","status",- "id",+ "updatedAt","createdAt",- "updatedAt"+ "id"]},{"name": "stockTransfer","rows": 0,"columns": [- "createdAt",- "status","tags","locationId",- "completedAt",+ "status",+ "createdAt","assignee",- "updatedBy",- "createdBy",- "customFields",+ "completedAt","stockTransferId",- "companyId",- "notes",+ "customFields",+ "createdBy",+ "updatedBy",+ "updatedAt","id",- "updatedAt"+ "notes",+ "companyId"]},{@@ -2291,15 +2307,15 @@"name": "suggestion","rows": 0,"columns": [- "suggestion",+ "userId",+ "emoji",+ "path",+ "attachmentPath","companyId",- "id",- "createdAt",+ "suggestion","tags",- "path",- "emoji",- "userId",- "attachmentPath"+ "createdAt",+ "id"]},{@@ -2322,61 +2338,61 @@"name": "tableView","rows": 0,"columns": [- "sortOrder",- "columnVisibility",- "id",- "sorts",+ "columnOrder",+ "createdBy",+ "table",+ "description",+ "updatedBy",+ "companyId",+ "type","columnPinning","filters",- "createdAt","name",- "updatedBy",- "type",- "companyId",- "columnOrder",- "table",- "createdBy",- "description"+ "createdAt",+ "sortOrder",+ "columnVisibility",+ "id",+ "sorts"]},{"name": "tag","rows": 0,"columns": [- "createdBy",+ "table",+ "name",+ "updatedBy","createdAt","companyId",- "updatedBy",- "name",- "table"+ "createdBy"]},{"name": "terms","rows": 0,"columns": [- "id","purchasingTerms",- "updatedBy",+ "id",+ "updatedAt","salesTerms",- "updatedAt"+ "updatedBy"]},{"name": "timeCardEntry","rows": 0,"columns": [- "createdAt",- "id",- "updatedAt",- "note",- "employeeId",- "createdBy",- "updatedBy",- "clockOut",+ "autoCloseShiftId","companyId","clockIn",- "autoCloseShiftId"+ "clockOut",+ "updatedBy",+ "createdBy",+ "employeeId",+ "note",+ "updatedAt",+ "createdAt",+ "id"]},{@@ -2399,94 +2415,94 @@"name": "trackedActivity","rows": 0,"columns": [- "id",- "createdBy",- "attributes",- "type",+ "companyId",+ "sourceDocument",+ "sourceDocumentId",+ "sourceDocumentReadableId","createdAt","updatedBy",- "sourceDocumentReadableId",- "sourceDocumentId",- "sourceDocument",- "companyId"+ "type",+ "attributes",+ "createdBy",+ "id"]},{"name": "training","rows": 0,"columns": [- "id",- "content",- "tags","status",- "updatedAt",+ "tags",+ "content",+ "id",+ "estimatedDuration",+ "type","name","companyId",- "type",- "estimatedDuration",- "assignee",- "processId",+ "updatedAt","updatedBy","createdBy",- "version",+ "assignee",+ "processId",+ "frequency",+ "grantsAbilityId","createdAt","description",- "grantsAbilityId",- "frequency"+ "version"]},{"name": "trainingAssignment","rows": 0,"columns": [- "id",- "createdBy",- "trainingId",- "updatedBy","createdAt","groupIds","companyId",- "updatedAt"+ "updatedAt",+ "id",+ "createdBy",+ "trainingId",+ "updatedBy"]},{"name": "trainingCompletion","rows": 0,"columns": [- "employeeId",- "companyId",- "createdAt",- "completedAt",- "trainingAssignmentId","updatedBy","createdBy",+ "trainingAssignmentId",+ "completedBy","period","updatedAt","id",- "completedBy"+ "createdAt",+ "employeeId",+ "companyId",+ "completedAt"]},{"name": "trainingQuestion","rows": 0,"columns": [- "type",- "question",- "createdAt",- "options","sortOrder","tolerance","createdBy","updatedBy",+ "question",+ "createdAt",+ "type",+ "options",+ "correctNumber",+ "correctBoolean",+ "id",+ "required","companyId","trainingId","updatedAt","matchingPairs",- "correctAnswers",- "correctNumber",- "id",- "correctBoolean",- "required"+ "correctAnswers"]},{@@ -2542,76 +2558,76 @@"name": "assemblyComponentMapping","rows": 0,"columns": [- "confidence",- "itemId",- "geometryHash",- "createdBy",- "id",- "updatedBy",- "companyId",- "modelUploadId","updatedAt",- "createdAt"+ "createdAt",+ "modelUploadId",+ "companyId",+ "updatedBy",+ "id",+ "createdBy",+ "geometryHash",+ "itemId",+ "confidence"]},{"name": "assemblyInstruction","rows": 0,"columns": [+ "status",+ "customFields",+ "settings",+ "id","companyId","publishedAt",- "createdBy","name",+ "createdBy","updatedAt",- "status",- "customFields",- "id",- "settings",- "version",- "itemId",- "modelUploadId",- "createdAt",- "updatedBy","rootInstructionId",+ "updatedBy",+ "tags","assemblyPlanJobId",- "tags"+ "version",+ "createdAt",+ "modelUploadId",+ "itemId"]},{"name": "assemblyInstructionStep","rows": 0,"columns": [- "motion",- "createdAt",- "warnings",- "notes",- "maxValue",- "rootStepId",- "fastener",- "title",- "planConfidence",- "updatedAt",- "description",- "durationSeconds",- "camera",- "explode",- "fileTypes",- "parentStepId",- "sortOrder",+ "companyId",+ "unitOfMeasureCode",+ "instructionText",+ "buildWave",+ "status",+ "listValues",+ "assemblyInstructionId",+ "componentNodeIds","createdBy","type",- "minValue","updatedBy",- "required",+ "minValue","id",- "unitOfMeasureCode",- "companyId",- "status",- "buildWave",- "instructionText",- "assemblyInstructionId",- "listValues",- "componentNodeIds"+ "required",+ "durationSeconds",+ "description",+ "updatedAt",+ "explode",+ "camera",+ "sortOrder",+ "parentStepId",+ "fileTypes",+ "warnings",+ "notes",+ "createdAt",+ "motion",+ "title",+ "fastener",+ "maxValue",+ "rootStepId",+ "planConfidence"]},{@@ -2620,11 +2636,11 @@"columns": ["sortOrder","createdBy",- "itemId","quantity",+ "itemId","companyId",- "updatedBy","id",+ "updatedBy","createdAt","updatedAt","stepId"@@ -2634,85 +2650,85 @@"name": "assemblyInstructionStepSlide","rows": 0,"columns": [- "updatedAt",- "stepId",- "annotations","createdBy",+ "annotations",+ "stepId",+ "updatedAt",+ "sortOrder",+ "createdAt","id","companyId",- "createdAt",- "sortOrder",+ "size","modelUploadId","imagePath",- "size",- "caption",- "updatedBy"+ "updatedBy",+ "caption"]},{"name": "assemblyInstructionStepTool","rows": 0,"columns": [- "createdBy",- "itemId",- "quantity","sortOrder",- "createdAt",- "updatedAt",- "stepId",- "companyId",+ "quantity",+ "itemId",+ "createdBy",+ "id","updatedBy",- "id"+ "companyId",+ "stepId",+ "createdAt",+ "updatedAt"]},{"name": "assemblyUnit","rows": 0,"columns": [- "companyId",+ "itemId",+ "componentNodeIds",+ "name",+ "createdBy","id","updatedBy","sourceGroupId",- "createdAt",- "updatedAt",+ "companyId","modelUploadId",- "itemId",- "createdBy",- "componentNodeIds",- "name"+ "createdAt",+ "updatedAt"]},{"name": "batchProperty","rows": 0,"columns": [- "createdAt",- "updatedAt",- "itemId",- "sortOrder",+ "listOptions",+ "label",+ "dataType",+ "companyId","createdBy","id","updatedBy",- "companyId",- "label",- "dataType",- "listOptions"+ "sortOrder",+ "itemId",+ "createdAt",+ "updatedAt"]},{"name": "changeOrderSupersession","rows": 0,"columns": [- "createdBy",- "companyId","changeOrderId",- "discontinuationDate",- "updatedAt",+ "companyId",+ "createdBy","id","createdAt",- "successorEffectivityDate",+ "updatedAt",+ "discontinuationDate","successorItemId","predecessorItemId",+ "successorEffectivityDate","supersessionMode","updatedBy"]@@ -2721,192 +2737,192 @@"name": "configurationParameterGroup","rows": 0,"columns": [- "itemId",- "id",- "companyId","name","sortOrder",- "isUngrouped"+ "isUngrouped",+ "itemId",+ "id",+ "companyId"]},{"name": "configurationParameter","rows": 0,"columns": [+ "dataType",+ "updatedAt",+ "configurationParameterGroupId","label","materialFormFilterId","key",- "configurationParameterGroupId",- "updatedAt",- "dataType",- "itemId",- "updatedBy",- "sortOrder",- "createdAt",+ "listOptions","companyId","id","createdBy",- "listOptions"+ "sortOrder",+ "createdAt",+ "updatedBy",+ "itemId"]},{"name": "configurationRule","rows": 0,"columns": [- "updatedBy",- "itemId",- "field",- "updatedAt",+ "code","companyId",- "code"+ "updatedAt",+ "field",+ "itemId",+ "updatedBy"]},{"name": "demandForecast","rows": 0,"columns": [- "confidence",+ "periodId",+ "forecastQuantity",+ "notes",+ "forecastMethod",+ "updatedBy",+ "locationId",+ "companyId",+ "createdAt","createdBy","itemId","updatedAt",- "companyId",- "createdAt",- "locationId",- "updatedBy",- "forecastMethod",- "notes",- "periodId",- "forecastQuantity"+ "confidence"]},{"name": "demandProjection","rows": 0,"columns": [+ "updatedBy",+ "forecastMethod","notes","forecastQuantity","periodId",- "forecastMethod",- "updatedBy",- "companyId",- "createdAt",- "id",- "locationId","confidence",+ "updatedAt","itemId","createdBy",- "updatedAt"+ "createdAt",+ "companyId",+ "locationId",+ "id"]},{"name": "enforcementRuleItemAssignment","rows": 0,"columns": [- "createdBy",- "companyId","createdAt",- "ruleId",+ "companyId",+ "createdBy",+ "itemId","updatedBy",- "itemId"+ "ruleId"]},{"name": "inspectionDocument","rows": 0,"columns": [- "samplingSampleSize",- "samplingSeverity","updatedAt",- "createdBy",- "samplingInspectionLevel",- "version",- "fileName",- "samplingPercentage",- "samplingAql",- "updatedBy",- "partId",- "drawingNumber",- "storagePath",- "uploadedBy",- "defaultPageWidth",- "id",- "defaultPageHeight",- "pageCount",- "companyId",- "createdAt",- "samplingPlanType"- ]- },- {- "name": "inspectionFeature",- "rows": 0,- "columns": [- "type","samplingSeverity","samplingSampleSize",- "label",+ "version","samplingInspectionLevel",- "createdAt",- "nominalValue",- "samplingAql",- "samplingPercentage",- "pageNumber",- "updatedAt",- "companyId",- "description","createdBy",- "id",- "toleranceMinus",- "unit",- "tolerancePlus",+ "fileName",+ "drawingNumber",+ "partId","updatedBy",- "inspectionDocumentId",- "samplingPlanType"+ "samplingAql",+ "samplingPercentage",+ "storagePath",+ "id",+ "defaultPageWidth",+ "uploadedBy",+ "pageCount",+ "defaultPageHeight",+ "samplingPlanType",+ "createdAt",+ "companyId"]},{- "name": "balloon",+ "name": "inspectionFeature","rows": 0,"columns": [- "regionX",- "regionHeight",- "id",- "yCoordinate",- "regionWidth",- "xCoordinate","inspectionDocumentId",- "createdAt",- "updatedAt",+ "updatedBy",+ "samplingPlanType",+ "unit",+ "tolerancePlus","createdBy",+ "toleranceMinus",+ "id",+ "description",+ "samplingPercentage",+ "samplingAql",+ "companyId",+ "updatedAt","pageNumber",+ "nominalValue",+ "createdAt",+ "samplingInspectionLevel",+ "label",+ "samplingSampleSize",+ "type",+ "samplingSeverity"+ ]+ },+ {+ "name": "balloon",+ "rows": 0,+ "columns": ["regionY","updatedBy","companyId",- "inspectionFeatureId"+ "inspectionFeatureId",+ "updatedAt",+ "createdBy",+ "pageNumber",+ "xCoordinate",+ "regionWidth",+ "inspectionDocumentId",+ "createdAt",+ "regionX",+ "yCoordinate",+ "regionHeight",+ "id"]},{"name": "inventoryCountLine","rows": 0,"columns": [- "id",- "systemQuantity",- "storageUnitId",- "createdAt",- "companyId",- "countedAt",- "readableId",- "countedQuantity",- "countedBy",- "locationId",- "updatedBy","createdBy",- "itemId",+ "updatedBy",+ "locationId",+ "countedBy",+ "trackedEntityId","inventoryCountId","postedItemLedgerId",- "updatedAt",+ "itemId","customFields",- "trackedEntityId"+ "updatedAt",+ "storageUnitId",+ "systemQuantity",+ "id",+ "readableId",+ "countedQuantity",+ "createdAt",+ "countedAt",+ "companyId"]},{@@ -2932,14 +2948,14 @@"name": "itemInspectionDocumentAssignment","rows": 0,"columns": [- "inspectionDocumentId",- "companyId",- "updatedBy",- "createdBy","usage","updatedAt","itemId",- "createdAt"+ "createdAt",+ "companyId",+ "inspectionDocumentId",+ "updatedBy",+ "createdBy"]},{@@ -2973,53 +2989,53 @@"name": "itemSerialSequence","rows": 0,"columns": [+ "prefix",+ "itemId",+ "size","updatedAt","suffix",- "size",- "itemId",- "prefix",- "next",- "updatedBy",- "createdBy",- "id",+ "companyId","createdAt","step",- "companyId"+ "updatedBy",+ "id",+ "createdBy",+ "next"]},{"name": "itemShelfLife","rows": 0,"columns": [- "triggerTiming",- "calculateFromBom",- "days",- "triggerProcessId",- "createdBy",- "updatedBy",+ "createdAt",+ "updatedAt",+ "mode",+ "companyId","itemId",+ "updatedBy","customFields",- "companyId",- "mode",- "createdAt",- "updatedAt"+ "createdBy",+ "triggerProcessId",+ "days",+ "triggerTiming",+ "calculateFromBom"]},{"name": "itemSupersession","rows": 0,"columns": [- "successorEffectivityDate",- "createdAt",- "itemId",- "updatedAt","createdBy","updatedBy","companyId",- "discontinuationDate",+ "successorEffectivityDate",+ "itemId",+ "createdAt",+ "updatedAt","conversionFactor",+ "successorItemId","supersessionMode",- "successorItemId"+ "discontinuationDate"]},{@@ -3064,45 +3080,53 @@"name": "changeOrderAffectedItem","rows": 0,"columns": [- "itemId",- "createdAt",- "sortOrder",- "baseMakeMethodId",- "changeSummary",- "changeType",- "updatedBy",- "createdBy",- "changeOrderId",+ "newItemId",+ "id",+ "discontinuationDate",+ "draftMakeMethodId","companyId",+ "changeOrderId","updatedAt","successorEffectivityDate","supersessionMode",- "newItemId",- "discontinuationDate",- "id",- "draftMakeMethodId"+ "changeType",+ "changeSummary",+ "createdBy",+ "updatedBy",+ "sortOrder",+ "itemId",+ "createdAt",+ "baseMakeMethodId"]},{"name": "nonConformanceItem","rows": 0,"columns": [- "updatedAt",- "companyId",- "itemId",- "createdAt","updatedBy","quantity","nonConformanceId","createdBy",+ "disposition","id",- "disposition"+ "updatedAt",+ "itemId",+ "companyId",+ "createdAt"]},{"name": "procedureStep","rows": 0,"columns": [+ "type",+ "description",+ "createdAt",+ "name",+ "createdBy",+ "updatedBy",+ "required",+ "fileTypes","maxValue","unitOfMeasureCode","companyId",@@ -3111,52 +3135,36 @@"sortOrder","listValues","minValue",- "id",- "type",- "description",- "name",- "createdAt",- "createdBy",- "updatedBy",- "required",- "fileTypes"+ "id"]},{"name": "purchasingRfqLine","rows": 0,"columns": [- "order",- "id",- "externalNotes",- "purchaseUnitOfMeasureCode",- "updatedAt",- "purchasingRfqId",- "customFields",- "conversionFactor",- "internalNotes",- "companyId",- "quantity",- "updatedBy",- "createdBy",+ "inventoryUnitOfMeasureCode","createdAt","itemId","description",- "inventoryUnitOfMeasureCode"+ "createdBy",+ "updatedBy",+ "quantity",+ "companyId",+ "conversionFactor",+ "internalNotes",+ "updatedAt",+ "customFields",+ "purchasingRfqId",+ "purchaseUnitOfMeasureCode",+ "order",+ "id",+ "externalNotes"]},{"name": "qualityDocumentStep","rows": 0,"columns": [- "type",- "description",- "createdAt",- "name",- "updatedBy",- "createdBy",- "fileTypes",- "required","unitOfMeasureCode","maxValue","updatedAt",@@ -3165,80 +3173,88 @@"sortOrder","id","minValue",- "listValues"+ "listValues",+ "type",+ "description",+ "name",+ "createdAt",+ "updatedBy",+ "createdBy",+ "fileTypes",+ "required"]},{"name": "riskRegister","rows": 0,"columns": [+ "source",+ "createdBy",+ "notes",+ "updatedBy",+ "title",+ "updatedAt",+ "description",+ "severity",+ "assignee",+ "itemId",+ "id",+ "sourceId","createdAt","companyId","type","status",- "likelihood",- "assignee",- "id",- "itemId",- "sourceId",- "description",- "updatedAt",- "title",- "severity",- "source",- "createdBy",- "notes",- "updatedBy"+ "likelihood"]},{"name": "trackedEntity","rows": 0,"columns": [- "attributes",- "updatedBy",- "status",- "sourceDocument","itemId","sourceDocumentId",- "createdBy",- "companyId",+ "status",+ "updatedBy",+ "sourceDocument",+ "attributes",+ "createdAt",+ "id",+ "readableId",+ "sourceDocumentReadableId","quantity","expirationDate",- "sourceDocumentReadableId",- "readableId",- "createdAt",- "id"+ "companyId",+ "createdBy"]},{"name": "nonConformanceItemTrackedEntity","rows": 0,"columns": [+ "quantity",+ "createdAt",+ "trackedEntityId",+ "nonConformanceId","companyId",- "updatedAt","id",+ "updatedAt","updatedBy","createdBy",- "nonConformanceItemId",- "quantity",- "createdAt",- "nonConformanceId",- "trackedEntityId"+ "nonConformanceItemId"]},{"name": "nonConformanceTrackedEntity","rows": 0,"columns": [- "updatedBy",- "nonConformanceId",- "createdBy","id",- "updatedAt",+ "createdBy",+ "nonConformanceId",+ "updatedBy",+ "createdAt","companyId","trackedEntityId",- "createdAt"+ "updatedAt"]},{@@ -3262,8 +3278,8 @@"createdBy","trackedActivityId","updatedBy",- "companyId","quantity",+ "companyId","createdAt"]},@@ -3325,13 +3341,13 @@"name": "userModulePreference","rows": 0,"columns": [- "id",- "hidden",- "userId",- "position",- "module","companyId",- "updatedAt"+ "module",+ "updatedAt",+ "position",+ "userId",+ "id",+ "hidden"]},{@@ -3363,261 +3379,261 @@"name": "warehouseTransfer","rows": 0,"columns": [- "transferDate",- "createdBy",- "id",- "reference",- "companyId",- "notes",- "updatedBy",- "transferId",- "tags",- "customFields",- "status",- "createdAt",- "expectedReceiptDate","toLocationId","fromLocationId",- "updatedAt"+ "updatedAt",+ "expectedReceiptDate",+ "status",+ "createdAt",+ "customFields",+ "tags",+ "updatedBy",+ "transferId",+ "notes",+ "companyId",+ "id",+ "reference",+ "createdBy",+ "transferDate"]},{"name": "workCenter","rows": 0,"columns": [- "companyId",- "requiredAbilityId",- "id","active","locationId",- "createdBy","name",+ "createdBy","updatedAt",- "alwaysOn",- "updatedBy",- "machineRate",- "laborRate",- "customFields",- "departmentId",- "batchCapacity",+ "companyId",+ "requiredAbilityId",+ "id","defaultStandardFactor","minimumBatchQuantity",- "tags","overheadRate",+ "tags",+ "createdAt","description",- "createdAt"+ "machineRate",+ "updatedBy",+ "alwaysOn",+ "customFields",+ "departmentId",+ "laborRate",+ "batchCapacity"]},{"name": "enforcementRuleWorkCenterAssignment","rows": 0,"columns": [- "createdBy",- "companyId",- "createdAt",- "ruleId","updatedBy",- "workCenterId"+ "workCenterId",+ "ruleId",+ "createdAt",+ "companyId",+ "createdBy"]},{"name": "jobOperationBatch","rows": 0,"columns": [- "updatedAt",- "readableId",- "createdBy",- "notes",- "createdAt",- "id",- "customFields",- "locationId",- "processId","mergeOutput","companyId",+ "processId","status",- "workCenterId","updatedBy",- "outputLotNumber"+ "workCenterId",+ "outputLotNumber",+ "readableId",+ "updatedAt",+ "notes",+ "createdBy",+ "customFields",+ "id",+ "createdAt",+ "locationId"]},{"name": "maintenanceSchedule","rows": 0,"columns": [- "updatedBy",- "description",- "workCenterId","thursday","wednesday",- "estimatedDuration",+ "workCenterId",+ "description",+ "updatedBy","skipHolidays",- "sunday",+ "estimatedDuration","frequency",- "createdBy","friday",+ "createdBy",+ "sunday","saturday","updatedAt",- "tuesday","takesWorkCenterOffline",- "monday",+ "tuesday","createdAt","name",- "active",+ "monday","locationId","nextDueAt",- "lastGeneratedAt",- "id",+ "active","companyId",- "priority",- "procedureId"+ "id",+ "lastGeneratedAt",+ "procedureId",+ "priority"]},{"name": "maintenanceDispatch","rows": 0,"columns": [- "assignee",- "completedAt",- "status",- "content",- "actualStartTime",- "updatedBy",- "locationId",- "priority",+ "createdAt","companyId","plannedStartTime",- "createdAt",+ "priority",+ "nonConformanceId","actualEndTime","createdBy",- "nonConformanceId",- "plannedEndTime",+ "status",+ "content",+ "actualStartTime",+ "completedAt",+ "assignee",+ "locationId",+ "updatedBy",+ "id",+ "maintenanceScheduleId",+ "severity",+ "actualFailureModeId",+ "source",+ "oeeImpact","maintenanceDispatchId",- "updatedAt",- "suspectedFailureModeId",+ "plannedEndTime","workCenterId","takesWorkCenterOffline","procedureId",- "severity",- "actualFailureModeId",- "id",- "maintenanceScheduleId",- "oeeImpact",- "source"+ "suspectedFailureModeId",+ "updatedAt"]},{"name": "maintenanceDispatchComment","rows": 0,"columns": [+ "createdBy","updatedBy","comment","companyId",- "createdBy",- "updatedAt",- "maintenanceDispatchId","createdAt",- "id"+ "id",+ "updatedAt",+ "maintenanceDispatchId"]},{"name": "maintenanceDispatchEvent","rows": 0,"columns": [+ "notes",+ "employeeId",+ "workCenterId",+ "updatedBy",+ "startTime","createdBy",- "updatedAt","maintenanceDispatchId",+ "updatedAt","endTime",- "createdAt","companyId","id",- "notes",- "employeeId",- "workCenterId",- "startTime",- "updatedBy"+ "createdAt"]},{"name": "maintenanceDispatchItem","rows": 0,"columns": [- "updatedBy",- "id",- "createdBy","unitCost",- "maintenanceDispatchId",- "createdAt",+ "createdBy",+ "id",+ "updatedBy","companyId",+ "createdAt",+ "maintenanceDispatchId","updatedAt","unitOfMeasureCode",- "quantity",- "itemId"+ "itemId",+ "quantity"]},{"name": "maintenanceDispatchItemTrackedEntity","rows": 0,"columns": [- "companyId",- "trackedEntityId",- "quantity","createdAt",- "updatedAt",- "id",- "createdBy",+ "quantity",+ "trackedEntityId",+ "companyId",+ "updatedBy","maintenanceDispatchItemId",- "updatedBy"+ "createdBy",+ "id",+ "updatedAt"]},{"name": "maintenanceDispatchWorkCenter","rows": 0,"columns": [+ "createdBy",+ "updatedBy","companyId","workCenterId",- "updatedBy",- "createdBy",- "maintenanceDispatchId",- "updatedAt",+ "createdAt","id",- "createdAt"+ "updatedAt",+ "maintenanceDispatchId"]},{"name": "maintenanceScheduleItem","rows": 0,"columns": [- "maintenanceScheduleId",- "createdAt",- "updatedAt",- "updatedBy",- "id",- "companyId",+ "unitOfMeasureCode",+ "createdBy","itemId","quantity",- "createdBy",- "unitOfMeasureCode"+ "companyId",+ "updatedBy",+ "id",+ "createdAt",+ "updatedAt",+ "maintenanceScheduleId"]},{"name": "peopleAssignment","rows": 0,"columns": [- "shiftId",- "workCenterId",- "hours",- "locationId",- "updatedAt",- "employeeId",+ "overtimeHours",+ "companyId","note","createdAt",- "companyId",- "overtimeHours",- "date",- "id","createdBy",- "updatedBy"+ "id",+ "updatedBy",+ "date",+ "locationId",+ "hours",+ "workCenterId",+ "shiftId",+ "employeeId",+ "updatedAt"]},{@@ -3689,23 +3705,23 @@"name": "warehouseTransferLine","rows": 0,"columns": [+ "customFields","quantity",- "itemId","createdBy",- "customFields",+ "itemId","fromLocationId","notes","shippedQuantity","updatedAt","createdAt",- "updatedBy","transferId","companyId",- "fromStorageUnitId",+ "updatedBy","toStorageUnitId",+ "fromStorageUnitId",+ "unitOfMeasureCode","id","toLocationId",- "unitOfMeasureCode","receivedQuantity"]},@@ -3713,29 +3729,29 @@"name": "workCenterProcess","rows": 0,"columns": [+ "processId","workCenterId","updatedBy",- "processId",- "createdAt",- "companyId","createdBy",- "updatedAt"+ "companyId",+ "updatedAt",+ "createdAt"]},{"name": "workCenterReplacementPart","rows": 0,"columns": [- "unitOfMeasureCode",+ "createdBy","itemId","quantity",- "createdBy",- "updatedBy",- "id",- "companyId",- "workCenterId",+ "unitOfMeasureCode",+ "updatedAt","createdAt",- "updatedAt"+ "workCenterId",+ "companyId",+ "updatedBy",+ "id"]},{@@ -3752,6 +3768,60 @@"updatedAt"]},+ {+ "name": "cardTransaction",+ "rows": 0,+ "columns": [+ "status",+ "postedAt",+ "cardLast4",+ "voidedAt",+ "postingDate",+ "postedBy",+ "updatedBy",+ "exchangeRate",+ "journalId",+ "amount",+ "type",+ "transactionDate",+ "cardTransactionId",+ "voidedBy",+ "cardAccountId",+ "customFields",+ "updatedAt",+ "cardHolderName",+ "id",+ "supplierId",+ "createdAt",+ "integration",+ "memo",+ "companyId",+ "currencyCode",+ "createdBy",+ "merchantName",+ "offsetAccountId"+ ]+ },+ {+ "name": "cardTransactionLine",+ "rows": 0,+ "columns": [+ "id",+ "createdBy",+ "updatedBy",+ "description",+ "customFields",+ "companyId",+ "sequence",+ "createdAt",+ "costCenterId",+ "updatedAt",+ "accountId",+ "projectId",+ "cardTransactionId",+ "amount"+ ]+ },{"name": "contractor","rows": 0,@@ -3843,63 +3913,63 @@"name": "customerBankAccount","rows": 0,"columns": [- "bankName","bankCode",- "currencyCode","id",- "accountNumber",- "countryCode",+ "currencyCode",+ "bankName","companyId","isPrimary","createdBy",- "createdAt",- "notes",- "tags",- "swiftBic",+ "accountNumber",+ "countryCode","customFields",+ "swiftBic","accountHolderName",- "bankAddress",+ "createdAt",+ "tags",+ "notes","updatedBy","updatedAt",+ "name","active","customerId",- "name"+ "bankAddress"]},{"name": "customerItemPriceOverride","rows": 0,"columns": [- "validTo",- "itemId",- "updatedAt","customerTypeId",+ "updatedAt",+ "itemId",+ "validTo","notes","createdAt",- "companyId",- "active","updatedBy","customerId",- "validFrom",+ "companyId",+ "active","createdBy",+ "applyRulesOnTop","id",- "applyRulesOnTop"+ "validFrom"]},{"name": "customerItemPriceOverrideBreak","rows": 0,"columns": [- "companyId","id","updatedBy",+ "companyId",+ "customerItemPriceOverrideId","createdAt","updatedAt",- "customerItemPriceOverrideId","active",- "createdBy","overridePrice",- "quantity"+ "quantity",+ "createdBy"]},{@@ -3976,17 +4046,17 @@"name": "customerTax","rows": 0,"columns": [- "vatNumber",- "eori","taxExemptionCertificateNumber",+ "eori",+ "vatNumber","taxExempt",- "taxId","taxExemptionCertificatePath","updatedAt",- "companyId",+ "taxId",+ "taxExemptionReason","customerId",- "updatedBy",- "taxExemptionReason"+ "companyId",+ "updatedBy"]},{@@ -4011,14 +4081,14 @@"name": "nonConformanceCustomer","rows": 0,"columns": [- "updatedAt",- "companyId",- "customerId",- "createdAt",- "updatedBy",- "nonConformanceId",+ "id","createdBy",- "id"+ "nonConformanceId",+ "updatedBy",+ "createdAt",+ "customerId",+ "companyId",+ "updatedAt"]},{@@ -4120,16 +4190,16 @@"name": "nonConformanceSalesOrderLine","rows": 0,"columns": [- "companyId",- "updatedAt",- "id",- "createdBy",- "updatedBy",- "nonConformanceId",- "salesOrderReadableId","createdAt","salesOrderLineId",- "salesOrderId"+ "salesOrderId",+ "salesOrderReadableId",+ "updatedBy",+ "createdBy",+ "nonConformanceId",+ "companyId",+ "updatedAt",+ "id"]},{@@ -4205,29 +4275,29 @@"name": "salesReturnOrder","rows": 0,"columns": [- "externalNotes",- "salesReturnOrderId",- "orderDate",- "locationId",- "replacementSalesOrderId",+ "customerContactId",+ "currencyCode","id","salesOrderId",- "currencyCode",- "customerContactId",- "customerId",- "expirationDate",- "status",- "companyId",- "createdBy",- "customFields",- "customerReference",- "updatedAt",+ "replacementSalesOrderId",+ "locationId",+ "orderDate",+ "salesReturnOrderId",+ "externalNotes",+ "updatedBy",+ "internalNotes",+ "assignee",+ "customerLocationId","createdAt","exchangeRate",- "customerLocationId",- "assignee",- "internalNotes",- "updatedBy"+ "updatedAt",+ "customFields",+ "customerReference",+ "createdBy",+ "companyId",+ "customerId",+ "expirationDate",+ "status"]},{@@ -4297,14 +4367,14 @@"name": "externalLink","rows": 0,"columns": [- "createdAt","companyId",- "customerId","documentId",- "expiresAt",- "id",+ "customerId",+ "createdAt","supplierId",- "documentType"+ "documentType",+ "expiresAt",+ "id"]},{@@ -4345,72 +4415,72 @@"status","customerEngineeringContactId","externalNotes"- ]- },- {- "name": "job",- "rows": 0,- "columns": [- "createdBy",- "salesOrderLineId",- "notes",- "quantityReceivedToInventory",- "assignee",- "modelUploadId",- "releasedDate",- "customerId",- "updatedBy",- "startDate",- "customFields",- "status",- "completedDate",- "unitOfMeasureCode",- "itemId",- "quantityShipped",- "quoteId",- "projectedCompletionAt",- "quoteLineId",+ ]+ },+ {+ "name": "job",+ "rows": 0,+ "columns": [+ "companyId",+ "quantity",+ "estimatedTime",+ "tags",+ "configuration",+ "dueDate",+ "quantityComplete",+ "scheduleOutdatedReason",+ "jobId",+ "actualTime",+ "salesOrderId",+ "createdAt","scheduleOutdatedAt","locationId",- "createdAt",- "id",- "deadlineType",- "updatedAt",- "scrapQuantity","priority","storageUnitId",- "dueDate",- "configuration",- "tags",- "quantity",- "estimatedTime",- "companyId",- "salesOrderId",- "actualTime",- "jobId",- "quantityComplete",- "scheduleOutdatedReason"+ "scrapQuantity",+ "updatedAt",+ "deadlineType",+ "id",+ "completedDate",+ "status",+ "customFields",+ "startDate",+ "updatedBy",+ "quoteLineId",+ "quoteId",+ "projectedCompletionAt",+ "quantityShipped",+ "itemId",+ "unitOfMeasureCode",+ "notes",+ "quantityReceivedToInventory",+ "salesOrderLineId",+ "createdBy",+ "customerId",+ "releasedDate",+ "modelUploadId",+ "assignee"]},{"name": "fulfillment","rows": 0,"columns": [- "salesOrderLineId",- "createdBy",- "id",- "updatedBy",- "companyId",+ "createdAt","quantity","type",- "createdAt",- "jobId"+ "jobId",+ "createdBy",+ "salesOrderLineId",+ "companyId",+ "id",+ "updatedBy"]},{"name": "jobFavorite","rows": 0,- "columns": ["jobId", "userId"]+ "columns": ["userId", "jobId"]},{"name": "quoteFavorite",@@ -4479,14 +4549,14 @@"name": "quotePayment","rows": 0,"columns": [- "updatedAt",- "customFields","invoiceCustomerId",+ "customFields",+ "updatedAt","id","updatedBy",- "companyId","invoiceCustomerContactId","invoiceCustomerLocationId",+ "companyId","paymentTermId"]},@@ -4495,199 +4565,199 @@"rows": 0,"columns": ["updatedBy",- "shippingTermId","shippingMethodId",+ "shippingTermId","incotermLocation","receiptRequestedDate","updatedAt","locationId","companyId",- "incoterm",+ "shippingCost","id",- "shippingCost"+ "incoterm"]},{"name": "capacityReservation","rows": 0,"columns": [- "updatedAt",- "companyId",- "workHours",- "createdBy",- "endAt",- "createdAt",- "scenarioId",- "id",- "jobId",+ "operationId",+ "updatedBy",+ "scheduleNote",+ "isPlaceholder","jobOperationBatchId","earliestStartAt","resourceKind","resourceId","startAt",- "operationId",- "updatedBy",- "scheduleNote",- "isPlaceholder"+ "createdAt",+ "scenarioId",+ "id",+ "jobId",+ "updatedAt",+ "companyId",+ "workHours",+ "createdBy",+ "endAt"]},{"name": "gauge","rows": 0,"columns": [- "gaugeRole",+ "gaugeTypeId",+ "gaugeStatus",+ "storageUnitId",+ "gaugeId",+ "lastCalibrationDate",+ "description","gaugeCalibrationStatus","id",- "description",- "lastCalibrationDate",- "gaugeId",- "storageUnitId",- "gaugeStatus",- "gaugeTypeId",- "serialNumber",- "calibrationIntervalInMonths",- "createdBy",- "updatedBy",- "updatedAt",- "locationId",- "companyId",- "createdAt",- "customFields",+ "gaugeRole",+ "dateAcquired",+ "lastCalibrationStatus","nextCalibrationDate","supplierId","modelNumber",- "dateAcquired",- "lastCalibrationStatus"+ "customFields",+ "createdAt",+ "companyId",+ "locationId",+ "updatedAt",+ "updatedBy",+ "calibrationIntervalInMonths",+ "createdBy",+ "serialNumber"]},{"name": "gaugeCalibrationRecord","rows": 0,"columns": [+ "approvedBy",+ "measurementStandard",+ "inspectionStatus",+ "dateCalibrated",+ "updatedBy",+ "requiresRepair","calibrationAttempts","createdBy","requiresAction","humidity","supplierId",- "inspectionStatus",- "updatedBy",- "dateCalibrated",- "approvedBy",- "measurementStandard",- "requiresRepair",- "id",- "customFields",- "createdAt",- "requiresAdjustment",- "temperature","gaugeId","updatedAt",+ "temperature",+ "companyId","notes",- "companyId"+ "createdAt",+ "id",+ "customFields",+ "requiresAdjustment"]},{"name": "inspection","rows": 0,"columns": [- "updatedAt",- "itemReadableId",- "sampleSize",- "inspectionDocumentId",- "samplingStandard",- "id",- "samplingPlanType",+ "createdAt",+ "supplierId",+ "sourceDocument",+ "notes",+ "status",+ "aql",+ "dispositionedAt",+ "inspectionLevel",+ "updatedBy",+ "codeLetter",+ "itemId",+ "dispositionedBy",+ "acceptanceNumber",+ "sourceDocumentReadableId",+ "companyId","createdBy",- "sourceDocumentId",+ "samplingPlanType","lotSize","sourceDocumentLineId",- "inspectionId",+ "sourceDocumentId","rejectionNumber",+ "inspectionId","severity",- "codeLetter",- "updatedBy",- "inspectionLevel",- "dispositionedAt",- "sourceDocumentReadableId",- "acceptanceNumber",- "dispositionedBy",- "itemId",- "companyId",- "sourceDocument",- "supplierId",- "createdAt",- "status",- "notes",- "aql"+ "updatedAt",+ "itemReadableId",+ "inspectionDocumentId",+ "sampleSize",+ "id",+ "samplingStandard"]},{"name": "inspectionSample","rows": 0,"columns": [- "notes",- "updatedBy",- "inspectedAt",- "status",- "trackedEntityId",+ "createdBy",+ "companyId",+ "inspectionId","inspectedBy","updatedAt",- "id","createdAt",- "createdBy",- "companyId",- "inspectionId"+ "id",+ "inspectedAt",+ "trackedEntityId",+ "status",+ "notes",+ "updatedBy"]},{"name": "inspectionMeasurement","rows": 0,"columns": [- "createdAt",- "value",- "inspectionFeatureId",- "inspectionSampleId",- "updatedAt",- "notes",+ "updatedBy",+ "inspectionId",+ "companyId",+ "inspectedBy","createdBy","id","inspectedAt","status",- "inspectionId",- "updatedBy",- "companyId",- "inspectedBy"+ "inspectionFeatureId",+ "updatedAt",+ "inspectionSampleId",+ "notes",+ "value",+ "createdAt"]},{"name": "inspectionSamplingPlan","rows": 0,"columns": [- "companyId",- "createdAt",- "inspectionId","rejectionNumber",+ "updatedBy","createdBy","id",- "updatedBy",+ "createdAt",+ "companyId",+ "inspectionId",+ "updatedAt",+ "acceptanceNumber","codeLetter","inspectionFeatureId",- "sampleSize",- "acceptanceNumber",- "updatedAt"+ "sampleSize"]},{"name": "nonConformanceInspection","rows": 0,"columns": [- "createdBy",- "id",- "nonConformanceId",- "createdAt",- "updatedBy","companyId",- "inspectionId"+ "inspectionId",+ "updatedBy",+ "createdAt",+ "nonConformanceId",+ "id",+ "createdBy"]},{@@ -4695,8 +4765,8 @@"rows": 0,"columns": ["severity",- "id","lotSize",+ "id","defectsFound","aql","sampleSize",@@ -4707,9 +4777,9 @@"samplingStandard","outcome","inspectionLevel",- "supplierId",+ "itemId","createdAt",- "itemId"+ "supplierId"]},{@@ -4739,36 +4809,49 @@"name": "jobMakeMethod","rows": 0,"columns": [- "version",- "trackedEntityId",- "quantityPerParent",- "createdAt",- "itemId",- "parentMaterialId",- "requiresBatchTracking",- "companyId",+ "itemScrapPercentage",+ "jobId",+ "requiresSerialTracking",+ "createdBy",+ "updatedBy","id","updatedAt","customFields",- "createdBy",- "updatedBy",- "itemScrapPercentage",- "jobId",- "requiresSerialTracking"+ "companyId",+ "itemId",+ "requiresBatchTracking",+ "parentMaterialId",+ "createdAt",+ "trackedEntityId",+ "quantityPerParent",+ "version"]},{"name": "jobMaterial","rows": 0,"columns": [+ "quantity",+ "id",+ "methodType",+ "quantityIssued",+ "createdBy",+ "jobId",+ "unitCost",+ "requiresBatchTracking",+ "kit",+ "description",+ "scrapQuantity",+ "substitutionFactor",+ "storageUnitId","estimatedQuantity",- "itemScrapPercentage","unitOfMeasureCode",+ "itemScrapPercentage","jobMakeMethodId","itemType","updatedAt",- "createdAt","jobOperationId",+ "createdAt","companyId","itemId","updatedBy",@@ -4776,104 +4859,91 @@"requiresSerialTracking","order","defaultStorageUnit",- "substitutedFromItemId",- "quantity",- "id",- "methodType",- "quantityIssued",- "createdBy",- "jobId",- "unitCost",- "requiresBatchTracking",- "kit",- "description",- "substitutionFactor",- "scrapQuantity",- "storageUnitId"+ "substitutedFromItemId"]},{"name": "stockTransferLine","rows": 0,"columns": [- "trackedEntityId",- "pickedQuantity",- "id","fromStorageUnitId",- "requiresSerialTracking",- "stockTransferId",- "createdBy",+ "id",+ "pickedQuantity",+ "trackedEntityId","quantity",- "itemId",- "requiresBatchTracking",- "createdAt",+ "createdBy",+ "stockTransferId",+ "requiresSerialTracking","updatedAt",- "updatedBy",- "jobId",- "companyId",+ "createdAt",+ "requiresBatchTracking",+ "itemId",+ "toStorageUnitId","jobMaterialId",- "toStorageUnitId"+ "companyId",+ "jobId",+ "updatedBy"]},{"name": "jobMaterialStep","rows": 0,- "columns": ["quantity", "jobMaterialId", "jobOperationStepId"]+ "columns": ["quantity", "jobOperationStepId", "jobMaterialId"]},{"name": "jobOperation","rows": 0,"columns": [- "hasConflict",- "workCenterId",- "createdAt",- "readyAt",- "inspectionDocumentId",- "id",- "projectedCompletionAt",- "setupUnit",- "updatedAt",- "laborUnit",- "tags",- "procedureId",- "setupTime",- "operationQuantity",- "customFields",- "targetQuantity",- "quantityReworked",- "laborTime",- "companyId",- "conflictReason",- "overheadRate",- "status",- "jobId",- "dueDate",- "machineUnit",- "manuallyScheduled",- "createdBy",- "machineRate",- "laborRate",- "operationUnitCost",- "operationSupplierProcessId",- "reworkId",- "operationLeadTime",- "quantityComplete",- "machineTime",- "processId",- "updatedBy",- "assignee",+ "assemblyInstructionId",+ "operationMinimumCost",+ "startDate",+ "operationType",+ "order",+ "operationOrder",+ "jobMakeMethodId",+ "jobOperationBatchId",+ "quantityScrapped","workInstruction",+ "assignee","priority","description",- "quantityScrapped",- "jobOperationBatchId",- "order",- "jobMakeMethodId",- "operationOrder",- "startDate",- "operationType",- "assemblyInstructionId",- "operationMinimumCost"+ "updatedBy",+ "processId",+ "operationLeadTime",+ "quantityComplete",+ "machineTime",+ "reworkId",+ "operationSupplierProcessId",+ "laborRate",+ "operationUnitCost",+ "createdBy",+ "machineRate",+ "manuallyScheduled",+ "dueDate",+ "machineUnit",+ "jobId",+ "status",+ "overheadRate",+ "conflictReason",+ "companyId",+ "quantityReworked",+ "laborTime",+ "targetQuantity",+ "operationQuantity",+ "setupTime",+ "customFields",+ "tags",+ "procedureId",+ "updatedAt",+ "laborUnit",+ "projectedCompletionAt",+ "id",+ "setupUnit",+ "inspectionDocumentId",+ "readyAt",+ "createdAt",+ "hasConflict",+ "workCenterId"]},{@@ -4891,15 +4961,15 @@"name": "jobOperationParameter","rows": 0,"columns": [- "updatedBy",- "id",- "createdAt",- "key",- "updatedAt",- "companyId",+ "createdBy","value","operationId",- "createdBy"+ "companyId",+ "updatedAt",+ "key",+ "createdAt",+ "updatedBy",+ "id"]},{@@ -4921,109 +4991,109 @@"name": "nonConformanceJobOperation","rows": 0,"columns": [- "jobReadableId",- "jobId",- "jobOperationId",- "createdAt",+ "companyId","id","updatedAt",- "companyId",- "nonConformanceId","createdBy",- "updatedBy"+ "updatedBy",+ "nonConformanceId",+ "jobReadableId",+ "createdAt",+ "jobId",+ "jobOperationId"]},{"name": "pickingListLine","rows": 0,"columns": [- "jobOperationId",- "status",- "createdAt",- "updatedAt",- "quantityReturned","customFields",- "jobId",+ "quantityReturned","createdBy",+ "jobId","jobMaterialId","quantityToPick",- "toStorageUnitId",- "id",- "itemId",- "companyId",+ "status",+ "jobOperationId",+ "updatedAt",+ "createdAt","pickingListId",+ "companyId","updatedBy","storageUnitId",- "quantityPicked"+ "quantityPicked",+ "toStorageUnitId",+ "id",+ "itemId"]},{"name": "pickingListLineTrackedEntity","rows": 0,"columns": [- "pickingListLineId",- "trackedEntityId",- "companyId","quantityPicked",- "quantity"+ "quantity",+ "companyId",+ "trackedEntityId",+ "pickingListLineId"]},{"name": "productionEvent","rows": 0,"columns": [- "createdAt",- "workCenterId",- "updatedBy",- "jobOperationId",- "postedToGL",+ "endTime",+ "updatedAt",+ "notes",+ "jobOperationBatchId",+ "type",+ "startTime",+ "employeeId","createdBy","companyId","id",- "employeeId",- "type",- "startTime",- "notes",- "jobOperationBatchId",- "endTime",- "updatedAt"+ "updatedBy",+ "jobOperationId",+ "postedToGL",+ "createdAt",+ "workCenterId"]},{"name": "productionQuantity","rows": 0,"columns": [- "quantity",- "scrapReasonId",- "type",- "machineProductionEventId",- "updatedAt",- "setupProductionEventId",- "inspectionId",+ "notes",+ "createdAt","inspectionSampleId","jobOperationId","updatedBy",- "notes",- "createdAt",- "id",+ "laborProductionEventId","companyId",+ "id","createdBy",- "laborProductionEventId"+ "machineProductionEventId",+ "type",+ "scrapReasonId",+ "quantity",+ "inspectionId",+ "updatedAt",+ "setupProductionEventId"]},{"name": "jobOperationNote","rows": 0,"columns": [+ "createdAt","companyId","note","updatedBy",- "createdAt",- "jobOperationId",- "updatedAt","id","productionQuantityId",- "createdBy"+ "createdBy",+ "jobOperationId",+ "updatedAt"]},{@@ -5032,78 +5102,78 @@"columns": ["targetJobOperationId","triggeredAtJobOperationId",- "updatedAt","reason",- "companyId",+ "updatedAt","requestedById",+ "companyId","jobId","quantity",- "createdAt","id",- "completedAt"+ "completedAt",+ "createdAt"]},{"name": "jobOperationStep","rows": 0,"columns": [- "nonConformanceInvestigationId",- "operationId",- "sortOrder",- "updatedBy",- "assemblyInstructionStepId",- "createdBy",- "description",- "nonConformanceActionId",- "required",- "createdAt",- "unitOfMeasureCode","fileTypes",- "id","maxValue",+ "id","type",- "name","companyId",+ "name","updatedAt","listValues",- "minValue"+ "minValue",+ "sortOrder",+ "operationId",+ "nonConformanceInvestigationId",+ "assemblyInstructionStepId",+ "createdBy",+ "updatedBy",+ "nonConformanceActionId",+ "description",+ "createdAt",+ "required",+ "unitOfMeasureCode"]},{"name": "jobOperationStepRecord","rows": 0,"columns": [- "createdBy",- "updatedBy",- "value","companyId",- "updatedAt","jobOperationStepId",+ "updatedAt","id",+ "createdBy",+ "updatedBy",+ "value",+ "userValue",+ "index","createdAt",- "numericValue","booleanValue",- "userValue",- "index"+ "numericValue"]},{"name": "jobOperationStepSlide","rows": 0,"columns": [- "caption",- "imagePath","createdBy",- "sortOrder",+ "imagePath",+ "caption","annotations",- "modelUploadId",- "stepId",+ "sortOrder","updatedAt","createdAt",+ "stepId",+ "modelUploadId",+ "companyId","size",- "id","updatedBy",- "companyId"+ "id"]},{@@ -5115,25 +5185,25 @@"name": "kanban","rows": 0,"columns": [- "companyId",+ "purchaseUnitOfMeasureCode",+ "autoRelease",+ "autoStartJob",+ "createdBy",+ "itemId",+ "storageUnitId","id","conversionFactor",- "storageUnitId",- "itemId",- "createdBy",- "autoStartJob",- "autoRelease",- "purchaseUnitOfMeasureCode",- "createdAt",- "locationId",- "completedBarcodeOverride",- "updatedBy",- "jobId",- "fromStorageUnitId",+ "companyId",+ "supplierId","quantity","updatedAt","replenishmentSystem",- "supplierId"+ "fromStorageUnitId",+ "jobId",+ "updatedBy",+ "completedBarcodeOverride",+ "locationId",+ "createdAt"]},{@@ -5222,24 +5292,24 @@"name": "methodOperationStep","rows": 0,"columns": [- "assemblyInstructionStepId",- "description",- "createdAt",- "required",- "unitOfMeasureCode",- "sortOrder",- "operationId",- "createdBy",- "updatedBy",- "companyId",- "name",- "updatedAt",- "listValues",- "minValue",- "fileTypes",+ "type","maxValue","id",- "type"+ "fileTypes",+ "minValue",+ "listValues",+ "updatedAt",+ "companyId",+ "name",+ "createdBy",+ "updatedBy",+ "sortOrder",+ "operationId",+ "unitOfMeasureCode",+ "createdAt",+ "required",+ "assemblyInstructionStepId",+ "description"]},{@@ -5249,12 +5319,12 @@"createdBy","imagePath","caption",- "annotations","sortOrder",+ "annotations","updatedAt","createdAt",- "stepId","modelUploadId",+ "stepId","companyId","size","updatedBy",@@ -5265,15 +5335,15 @@"name": "methodOperationTool","rows": 0,"columns": [- "createdBy",+ "id",+ "updatedBy",+ "createdAt",+ "operationId",+ "updatedAt",+ "companyId","quantity","toolId",- "companyId",- "updatedAt",- "operationId",- "createdAt",- "id",- "updatedBy"+ "createdBy"]},{@@ -5285,84 +5355,84 @@"name": "nonConformanceActionProcess","rows": 0,"columns": [- "createdAt",- "updatedAt",+ "actionTaskId",+ "updatedBy",+ "id",+ "createdBy","processId","companyId",- "createdBy",- "id",- "updatedBy",- "actionTaskId"+ "updatedAt",+ "createdAt"]},{"name": "nonConformanceActionTask","rows": 0,"columns": [- "assignee",- "updatedAt",- "status",- "supplierId",- "updatedBy",- "createdAt",- "dueDate",+ "completedDate",+ "companyId",+ "sortOrder",+ "id","tags","notes","nonConformanceId","createdBy","actionTypeId",- "completedDate",- "companyId",- "sortOrder",- "id"+ "supplierId",+ "updatedBy",+ "createdAt",+ "dueDate",+ "assignee",+ "updatedAt",+ "status"]},{"name": "nonConformancePurchaseReturnOrderLine","rows": 0,"columns": [- "id",+ "purchaseReturnOrderReadableId",+ "purchaseReturnOrderLineId",+ "purchaseReturnOrderId",+ "companyId","createdBy",+ "id","updatedBy","quantity","nonConformanceId","createdAt",- "updatedAt",- "purchaseReturnOrderReadableId",- "purchaseReturnOrderId",- "purchaseReturnOrderLineId",- "companyId"+ "updatedAt"]},{"name": "nonConformanceSalesReturnOrderLine","rows": 0,"columns": [- "id",- "updatedAt",- "companyId",- "nonConformanceId",- "updatedBy",- "createdBy",- "salesReturnOrderReadableId",+ "createdAt","salesReturnOrderId","salesReturnOrderLineId",- "createdAt"+ "salesReturnOrderReadableId",+ "updatedBy",+ "createdBy",+ "nonConformanceId",+ "companyId",+ "id",+ "updatedAt"]},{"name": "nonConformanceSupplier","rows": 0,"columns": [- "nonConformanceId",- "updatedBy",- "id",- "externalLinkId",- "createdBy",+ "updatedAt","companyId","supplierId",- "updatedAt",- "createdAt"+ "createdAt",+ "updatedBy",+ "nonConformanceId",+ "createdBy",+ "id",+ "externalLinkId"]},{@@ -5379,55 +5449,55 @@"tags","updatedBy","customFields",- "hoursPerWeek"- ]- },- {- "name": "payment",- "rows": 0,- "columns": [- "postingDate",- "exchangeRate",- "updatedAt",- "postedAt",- "paymentId",- "reference",- "supplierId",- "customFields",- "currencyCode",- "id",- "totalAmount",- "paymentDate",+ "hoursPerWeek"+ ]+ },+ {+ "name": "payment",+ "rows": 0,+ "columns": ["updatedBy",- "memo",- "paymentType",+ "paymentDate","status",+ "paymentType",+ "memo","voidedAt","voidedBy","postedBy","journalId","createdBy","createdAt",- "bankAccount","companyId",- "customerId"+ "bankAccount",+ "customerId",+ "postingDate",+ "exchangeRate",+ "updatedAt",+ "postedAt",+ "paymentId",+ "reference",+ "supplierId",+ "customFields",+ "id",+ "currencyCode",+ "totalAmount"]},{"name": "purchaseInvoiceDelivery","rows": 0,"columns": [+ "companyId","customFields","id","incotermLocation",- "companyId",- "locationId","updatedAt","incoterm",+ "locationId","supplierShippingCost",+ "updatedBy","shippingMethodId",- "shippingTermId",- "updatedBy"+ "shippingTermId"]},{@@ -5519,16 +5589,16 @@"name": "nonConformancePurchaseOrderLine","rows": 0,"columns": [- "companyId",- "updatedAt",- "id",- "updatedBy",- "createdBy",- "nonConformanceId","purchaseOrderReadableId",- "createdAt",+ "purchaseOrderId","purchaseOrderLineId",- "purchaseOrderId"+ "createdAt",+ "id",+ "updatedAt",+ "companyId",+ "nonConformanceId",+ "updatedBy",+ "createdBy"]},{@@ -5560,14 +5630,14 @@"name": "purchaseReturnOrderLineTrackedEntity","rows": 0,"columns": [- "createdAt",- "purchaseReturnOrderLineId",- "updatedAt",- "trackedEntityId","createdBy",- "updatedBy","quantity",- "companyId"+ "companyId",+ "updatedBy",+ "purchaseReturnOrderLineId",+ "createdAt",+ "trackedEntityId",+ "updatedAt"]},{@@ -5586,7 +5656,7 @@{"name": "purchasingRfqToPurchaseOrder","rows": 0,- "columns": ["purchasingRfqId", "purchaseOrderId", "companyId"]+ "columns": ["companyId", "purchaseOrderId", "purchasingRfqId"]},{"name": "purchasingRfqToSupplierQuote",@@ -5646,7 +5716,7 @@{"name": "quoteMaterialStep","rows": 0,- "columns": ["quoteMaterialId", "quoteOperationStepId", "quantity"]+ "columns": ["quoteOperationStepId", "quoteMaterialId", "quantity"]},{"name": "quoteOperation",@@ -5692,71 +5762,71 @@"name": "quoteOperationParameter","rows": 0,"columns": [- "createdAt",- "updatedBy",- "id","updatedAt","key",- "companyId",+ "createdAt",+ "id",+ "updatedBy","createdBy",+ "operationId","value",- "operationId"+ "companyId"]},{"name": "quoteOperationStep","rows": 0,"columns": [- "type",- "fileTypes",+ "operationId",+ "sortOrder",+ "updatedBy",+ "createdBy",+ "required",+ "createdAt",+ "description",+ "unitOfMeasureCode","id","maxValue",- "listValues",- "minValue",+ "fileTypes",+ "type",+ "updatedAt","name","companyId",- "updatedAt",- "updatedBy",- "createdBy",- "operationId",- "sortOrder",- "unitOfMeasureCode",- "description",- "required",- "createdAt"+ "minValue",+ "listValues"]},{"name": "quoteOperationStepSlide","rows": 0,"columns": [- "createdBy",- "caption",- "imagePath",- "annotations",- "sortOrder",- "updatedAt",- "createdAt",- "stepId","modelUploadId",- "companyId",- "size",+ "stepId",+ "createdAt",+ "updatedAt",+ "updatedBy","id",- "updatedBy"+ "size",+ "companyId",+ "imagePath",+ "caption",+ "createdBy",+ "sortOrder",+ "annotations"]},{"name": "quoteOperationTool","rows": 0,"columns": [- "operationId","updatedAt",+ "operationId",+ "createdAt","id","updatedBy",- "createdAt",+ "createdBy","quantity","toolId",- "createdBy","companyId"]},@@ -5769,16 +5839,16 @@"name": "receiptFixedAssetLine","rows": 0,"columns": [+ "serialNumber",+ "createdBy",+ "purchaseOrderLineId",+ "received","companyId",- "id","updatedAt",+ "id","createdAt","updatedBy",- "receiptId",- "serialNumber",- "createdBy",- "received",- "purchaseOrderLineId"+ "receiptId"]},{@@ -5810,15 +5880,15 @@"name": "nonConformanceReceiptLine","rows": 0,"columns": [- "receiptLineId","receiptId",+ "receiptLineId","createdAt","receiptReadableId","nonConformanceId",- "updatedBy","createdBy",- "updatedAt",+ "updatedBy","id",+ "updatedAt","companyId"]},@@ -5826,211 +5896,211 @@"name": "salesInvoice","rows": 0,"columns": [- "currencyCode",- "exchangeRate",- "companyId",- "totalDiscount",- "exchangeRateUpdatedAt",- "customerReference",- "createdAt",- "dateDue",+ "internalNotes","opportunityId","invoiceCustomerLocationId",- "internalNotes","createdBy","customerId",- "locationId","status",- "totalTax",+ "locationId","totalAmount",- "invoiceCustomerId",- "assignee",- "id",- "paymentTermId",- "customFields",- "dateIssued",- "tags",+ "totalTax",+ "companyId",+ "totalDiscount",+ "exchangeRate",+ "currencyCode",+ "exchangeRateUpdatedAt",+ "dateDue",+ "createdAt",+ "customerReference","invoiceCustomerContactId",+ "tags","externalNotes",- "shipmentId",- "updatedAt","postingDate",+ "updatedAt",+ "shipmentId","subtotal",- "datePaid",+ "updatedBy","invoiceId",- "updatedBy"+ "datePaid",+ "invoiceCustomerId",+ "assignee",+ "id",+ "paymentTermId",+ "customFields",+ "dateIssued"]},{"name": "salesInvoiceLine","rows": 0,"columns": [- "nonTaxableAddOnCost",- "opportunityId",- "unitOfMeasureCode","id","assetId",- "internalNotes",+ "opportunityId",+ "unitOfMeasureCode",+ "nonTaxableAddOnCost","methodType",- "storageUnitId",- "updatedAt",- "invoiceId",+ "internalNotes","setupPrice",- "externalNotes",- "createdBy",- "quantity",+ "invoiceId",+ "updatedAt",+ "storageUnitId","customFields","salesOrderLineId",- "itemId",+ "createdBy",+ "quantity",+ "externalNotes","companyId","locationId",- "unitPrice",+ "itemId","modelUploadId","addOnCost",- "taxPercent",- "sortOrder",- "shippingCost",+ "unitPrice","description",- "invoiceLineType","exchangeRate",- "createdAt",+ "invoiceLineType",+ "sortOrder",+ "shippingCost",+ "taxPercent",+ "salesOrderId","accountId","updatedBy",- "salesOrderId"+ "createdAt"]},{"name": "salesInvoiceShipment","rows": 0,"columns": [- "shippingCost",- "incotermLocation",- "createdAt",- "updatedAt",- "createdBy",- "id",- "updatedBy",- "customFields",+ "shippingTermId",+ "incoterm","locationId","shippingMethodId","companyId",- "incoterm",- "shippingTermId"+ "updatedBy",+ "createdBy",+ "id",+ "customFields",+ "incotermLocation",+ "shippingCost",+ "updatedAt",+ "createdAt"]},{"name": "salesReturnOrderLine","rows": 0,"columns": [- "unitOfMeasureCode",- "createdAt",- "updatedBy",- "itemId",- "disposition",- "lineNumber","createdBy","customFields","closedComplete",- "updatedAt","shipmentLineId",+ "updatedAt","quantity",+ "unitOfMeasureCode",+ "createdAt",+ "updatedBy",+ "disposition",+ "lineNumber",+ "itemId",+ "quantityReceived",+ "salesOrderLineId",+ "restockFeePercent",+ "id","returnReasonId","unitPrice","salesReturnOrderId","salesInvoiceLineId",- "companyId",- "quantityReceived",- "salesOrderLineId",- "id",- "restockFeePercent"+ "companyId"]},{"name": "salesReturnOrderLineTrackedEntity","rows": 0,"columns": [- "quantity",- "companyId",- "updatedBy",- "createdBy",- "trackedEntityId","updatedAt",+ "trackedEntityId",+ "createdAt","salesReturnOrderLineId",- "createdAt"+ "updatedBy",+ "quantity",+ "companyId",+ "createdBy"]},{"name": "salesReturnOrderCreditLine","rows": 0,"columns": [- "unitPrice",- "salesReturnOrderLineId",- "quantity",- "companyId",+ "memoId",+ "updatedBy",+ "createdBy","updatedAt",- "createdAt","id",+ "createdAt","restockFee",- "memoId",- "updatedBy",- "createdBy"+ "quantity",+ "salesReturnOrderLineId",+ "companyId",+ "unitPrice"]},{"name": "shipmentFixedAssetLine","rows": 0,"columns": [+ "serialNumber","createdBy",- "salesOrderLineId","shipped",- "serialNumber",- "updatedBy",- "createdAt",- "shipmentId",+ "salesOrderLineId","companyId",+ "id","updatedAt",- "id"+ "createdAt",+ "updatedBy",+ "shipmentId"]},{"name": "shipmentLine","rows": 0,"columns": [- "fulfillmentId",- "unitPrice",- "companyId",- "createdBy",+ "storageUnitId",+ "shippedQuantity",+ "shipmentId",+ "requiresSerialTracking",+ "createdAt",+ "orderQuantity",+ "unitOfMeasure",+ "id",+ "locationId",+ "outstandingQuantity",+ "updatedAt",+ "updatedBy","itemId","requiresBatchTracking","lineId",- "updatedBy",- "updatedAt",- "outstandingQuantity",- "id",- "locationId",- "unitOfMeasure",- "orderQuantity",- "createdAt",- "requiresSerialTracking",- "shipmentId",- "shippedQuantity",- "storageUnitId"+ "createdBy",+ "companyId",+ "fulfillmentId",+ "unitPrice"]},{"name": "nonConformanceShipmentLine","rows": 0,"columns": [- "shipmentReadableId",- "shipmentLineId",- "shipmentId",- "createdAt",- "updatedAt","id",+ "updatedAt","companyId","nonConformanceId","updatedBy",- "createdBy"+ "createdBy",+ "shipmentReadableId",+ "shipmentId",+ "shipmentLineId",+ "createdAt"]},{@@ -6072,33 +6142,33 @@"name": "supplierBankAccount","rows": 0,"columns": [- "customFields",- "swiftBic",- "accountHolderName",- "createdAt",- "tags",- "notes",- "name",- "active",- "supplierId",- "updatedBy",- "updatedAt",- "bankAddress",- "id","currencyCode",+ "id","bankCode","bankName","createdBy",- "companyId","isPrimary",+ "companyId","countryCode",- "accountNumber"+ "accountNumber",+ "accountHolderName",+ "swiftBic",+ "customFields",+ "notes",+ "tags",+ "createdAt",+ "active",+ "supplierId",+ "name",+ "updatedAt",+ "updatedBy",+ "bankAddress"]},{"name": "supplierInteraction","rows": 0,- "columns": ["supplierId", "id", "companyId"]+ "columns": ["companyId", "id", "supplierId"]},{"name": "receipt",@@ -6132,33 +6202,33 @@"name": "shipment","rows": 0,"columns": [- "shippingMethodId",- "tags",- "locationId",- "assignee",+ "externalNotes",+ "shipmentId",+ "invoiced",+ "trackingNumber",+ "status",+ "customFields",+ "id",+ "customerId",+ "externalDocumentId",+ "postingDate",+ "sourceDocumentReadableId",+ "supplierId","sourceDocument",+ "assignee",+ "locationId","companyId","createdAt",- "opportunityId",- "supplierInteractionId",- "internalNotes",- "updatedAt",+ "tags",+ "shippingMethodId","updatedBy",- "postedBy","createdBy",+ "postedBy","sourceDocumentId",- "trackingNumber",- "status",- "customFields",- "externalNotes",- "shipmentId",- "invoiced",- "sourceDocumentReadableId",- "supplierId",- "customerId",- "id",- "postingDate",- "externalDocumentId"+ "supplierInteractionId",+ "opportunityId",+ "internalNotes",+ "updatedAt"]},{@@ -6303,6 +6373,7 @@"companyId","requiredDate","invoiceId",+ "projectId","description","internalNotes","serviceId",@@ -6352,131 +6423,131 @@"name": "purchaseReturnOrder","rows": 0,"columns": [- "orderDate",- "purchaseReturnOrderId",- "externalNotes",- "replacementPurchaseOrderId",- "locationId",- "currencyCode",- "id",- "purchaseOrderId",- "supplierContactId",- "createdBy",- "companyId","supplierId",- "expirationDate","status",+ "expirationDate",+ "companyId",+ "createdBy","customFields","supplierReference",- "supplierLocationId",+ "updatedAt","createdAt","exchangeRate",- "updatedAt",- "internalNotes",+ "supplierLocationId",+ "assignee","updatedBy",- "assignee"+ "internalNotes",+ "externalNotes",+ "purchaseReturnOrderId",+ "orderDate",+ "locationId",+ "replacementPurchaseOrderId",+ "id",+ "purchaseOrderId",+ "currencyCode",+ "supplierContactId"]},{"name": "memo","rows": 0,"columns": [- "voidedBy",- "voidedAt",- "status",+ "postedAt",+ "memoId",+ "reference",+ "postingDate",+ "exchangeRate",+ "updatedAt",+ "currencyCode",+ "id",+ "amount",+ "purchaseReturnOrderId",+ "supplierId",+ "customFields","notes","direction",- "updatedBy",+ "status",+ "voidedAt",+ "voidedBy","memoDate",- "customerId",- "companyId",- "reasonAccount",+ "updatedBy","createdAt",- "journalId",- "createdBy",- "salesReturnOrderId",+ "reasonAccount",+ "companyId",+ "customerId","postedBy",- "reference",- "memoId",- "postedAt",- "updatedAt",- "exchangeRate",- "postingDate",- "purchaseReturnOrderId",- "amount",- "id",- "currencyCode",- "customFields",- "supplierId"+ "salesReturnOrderId",+ "createdBy",+ "journalId"]},{"name": "invoiceSettlement","rows": 0,"columns": [- "discountAmount",- "sourceExchangeRate",- "createdAt",- "appliedDate",- "paymentId",- "targetMemoId",- "id",- "writeOffAmount","targetExchangeRate",- "appliedAmount",- "targetSalesInvoiceId",- "companyId",- "memoId",- "sourcePaymentId",- "updatedBy",- "createdBy",- "appliedViaPaymentId",- "targetPurchaseInvoiceId",+ "writeOffAmount",+ "id",+ "targetMemoId",+ "paymentId",+ "appliedDate",+ "createdAt",+ "sourceExchangeRate",+ "discountAmount",+ "fxGainLossAmount","sourceAmount",- "fxGainLossAmount"+ "targetPurchaseInvoiceId",+ "appliedViaPaymentId",+ "createdBy",+ "updatedBy",+ "sourcePaymentId",+ "memoId",+ "companyId",+ "targetSalesInvoiceId",+ "appliedAmount"]},{"name": "purchaseReturnOrderLine","rows": 0,"columns": [- "returnReasonId",- "unitPrice",- "purchaseInvoiceLineId",- "purchaseReturnOrderId",- "createdBy","quantityShipped",- "purchaseOrderLineId","restockFeePercent","id",+ "purchaseOrderLineId",+ "unitPrice",+ "returnReasonId",+ "createdBy",+ "purchaseReturnOrderId",+ "purchaseInvoiceLineId",+ "createdAt",+ "companyId",+ "receiptLineId",+ "customFields",+ "quantity","unitOfMeasureCode",- "updatedAt",- "updatedBy",- "closedComplete","lineNumber",+ "closedComplete","itemId",- "companyId",- "createdAt",- "quantity",- "receiptLineId",- "customFields"+ "updatedBy",+ "updatedAt"]},{"name": "purchaseReturnOrderCreditLine","rows": 0,"columns": [- "unitPrice",- "companyId",- "purchaseReturnOrderLineId",- "quantity",+ "createdBy",+ "updatedBy",+ "memoId","restockFee",- "updatedAt","createdAt","id",- "updatedBy",- "createdBy",- "memoId"+ "updatedAt",+ "companyId",+ "purchaseReturnOrderLineId",+ "quantity",+ "unitPrice"]},{@@ -6506,17 +6577,17 @@"name": "supplierPartPrice","rows": 0,"columns": [- "sourceDocumentId",- "createdBy",- "sourceType",- "unitPrice","companyId","leadTime",- "supplierPartId","updatedBy",+ "supplierPartId","updatedAt","createdAt",- "quantity"+ "quantity",+ "sourceDocumentId",+ "createdBy",+ "unitPrice",+ "sourceType"]},{@@ -6541,11 +6612,11 @@"columns": ["supplierId","tags",- "createdAt","customFields",- "updatedBy",+ "createdAt","createdBy","id",+ "updatedBy","leadTime","processId","minimumCost",@@ -6557,32 +6628,32 @@"name": "supplierQuote","rows": 0,"columns": [- "tags",- "customFields",- "quotedDate",- "currencyCode",- "revisionId",- "updatedBy",- "internalNotes",- "expirationDate",- "createdAt",- "supplierReference",- "updatedAt",+ "status",+ "supplierQuoteType",+ "id",+ "supplierId",+ "supplierContactId",+ "externalNotes",+ "supplierInteractionId",+ "supplierLocationId",+ "exchangeRateUpdatedAt",+ "assignee",+ "supplierQuoteId","createdBy","exchangeRate","externalLinkId","companyId",- "assignee",- "supplierQuoteId",- "exchangeRateUpdatedAt",- "supplierInteractionId",- "supplierLocationId",- "externalNotes",- "supplierContactId",- "id",- "supplierId",- "supplierQuoteType",- "status"+ "updatedAt",+ "expirationDate",+ "createdAt",+ "supplierReference",+ "updatedBy",+ "internalNotes",+ "quotedDate",+ "currencyCode",+ "revisionId",+ "tags",+ "customFields"]},{@@ -6594,51 +6665,51 @@"name": "supplierQuoteLine","rows": 0,"columns": [- "purchaseUnitOfMeasureCode",- "ownerId",- "supplierPartRevision",- "id",- "supplierQuoteLineType",- "supplierQuoteId",- "createdBy",- "inventoryUnitOfMeasureCode",- "accountId",- "supplierPartId",+ "companyId",+ "internalNotes",+ "updatedAt",+ "requiredDate",+ "itemId","conversionFactor","tags",- "itemId","externalNotes",- "updatedAt",- "requiredDate",- "internalNotes",- "companyId",- "updatedBy",+ "description",+ "costCenterId",+ "sortOrder","customFields",+ "updatedBy","supplierQuoteRevisionId","quantity",- "sortOrder",- "description",- "costCenterId"+ "supplierQuoteLineType",+ "purchaseUnitOfMeasureCode",+ "ownerId",+ "supplierPartRevision",+ "id",+ "accountId",+ "inventoryUnitOfMeasureCode",+ "supplierPartId",+ "supplierQuoteId",+ "createdBy"]},{"name": "supplierQuoteLinePrice","rows": 0,"columns": [+ "updatedBy",+ "createdAt",+ "supplierUnitPrice","leadTime","quantity","updatedAt",- "createdAt",- "supplierUnitPrice",- "updatedBy",- "supplierQuoteLineId",- "createdBy",- "supplierTaxAmount",- "supplierShippingCost",- "companyId",+ "exchangeRate","taxPercent","supplierQuoteId",- "exchangeRate"+ "supplierShippingCost",+ "companyId",+ "supplierQuoteLineId",+ "createdBy",+ "supplierTaxAmount"]},{@@ -6664,17 +6735,17 @@"name": "supplierTax","rows": 0,"columns": [- "taxExemptionReason",- "updatedBy",- "supplierId",- "companyId",+ "taxExemptionCertificateNumber",+ "eori",+ "vatNumber",+ "taxExempt","updatedAt","taxExemptionCertificatePath","taxId",- "taxExempt",- "taxExemptionCertificateNumber",- "eori",- "vatNumber"+ "taxExemptionReason",+ "updatedBy",+ "supplierId",+ "companyId"]},{@@ -6683,11 +6754,11 @@"columns": ["companyId","updatedAt",- "nextRunAt","createdBy",+ "nextRunAt",+ "createdAt","canvasState","id",- "createdAt","name","description","publishedVersionId",@@ -6699,83 +6770,83 @@"name": "workflowVersion","rows": 0,"columns": [- "formatVersion",- "edges",- "workflowId","versionNumber",- "nodes",- "updatedAt",- "createdAt",- "id",+ "workflowId",+ "edges",+ "formatVersion",+ "companyId","updatedBy","createdBy",- "companyId"+ "updatedAt",+ "id",+ "createdAt",+ "nodes"]},{"name": "workflowRun","rows": 0,"columns": [+ "status",+ "triggerRecordId",+ "rootRunId",+ "companyId",+ "path",+ "sourceEventId",+ "statusReason",+ "id",+ "ownerId",+ "triggerTable",+ "durationMs",+ "completedAt","workflowVersionId","workflowId","causedByRunId",- "completedAt",- "durationMs",- "triggerTable",- "createdAt",- "error",- "isTest",- "eventId",- "startedAt","depth","compactedAt",- "path",- "companyId",- "rootRunId",- "triggerRecordId",- "status",- "id",- "ownerId",- "statusReason",- "sourceEventId"+ "startedAt",+ "eventId",+ "error",+ "isTest",+ "createdAt"]},{"name": "workflowStepRun","rows": 0,"columns": [+ "compactedAt",+ "durationMs",+ "branchTaken",+ "nodeId",+ "itemKey","completedAt","runId","sequence","createdAt","detail",- "itemKey",- "branchTaken",- "nodeId",- "compactedAt",- "durationMs",- "error",- "companyId",- "startedAt",- "status",- "input",+ "nodeType","statusReason","id","output",- "nodeType"+ "status",+ "input",+ "error",+ "companyId",+ "startedAt"]},{"name": "workflowTriggerEvent","rows": 0,"columns": [- "id",- "origin",- "companyId","eventId",- "workflowId",+ "createdAt","workflowVersionId",- "createdAt"+ "workflowId",+ "origin",+ "id",+ "companyId"]}],