{"record":{"id":"bb2aab4ce2204707","repo":"aureuserp/aureuserp","slug":"accounts-account-manager-post-action-validate-ban","errorCode":null,"errorMessage":"accounts::account-manager.post-action-validate.bank-archived","messagePattern":"accounts::account-manager\\.post-action-validate\\.bank-archived","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"plugins/webkul/accounts/src/Services/MoveWorkflow.php","lineNumber":251,"sourceCode":"                'name'    => $partner?->name,\n            ],\n        ];\n    }\n\n    public function assertPostable(AccountMove $move): void\n    {\n        if (! $move->partner_id) {\n            if ($move->isSaleDocument(true)) {\n                throw new Exception(__('accounts::account-manager.post-action-validate.customer-required'));\n            }\n\n            if ($move->isPurchaseDocument(true)) {\n                throw new Exception(__('accounts::account-manager.post-action-validate.vendor-required'));\n            }\n        }\n\n        if ($move->partnerBank?->trashed()) {\n            throw new Exception(__('accounts::account-manager.post-action-validate.bank-archived'));\n        }\n\n        if (float_compare($move->amount_total, 0, precisionRounding: $move->currency->rounding) < 0) {\n            throw new Exception(__('accounts::account-manager.post-action-validate.negative-amount'));\n        }\n\n        if (! $move->invoice_date) {\n            if ($move->isSaleDocument(true)) {\n                $move->invoice_date = now();\n            } elseif ($move->isPurchaseDocument(true)) {\n                throw new Exception(__('accounts::account-manager.post-action-validate.date-required'));\n            }\n        }\n\n        if (in_array($move->state, [MoveState::POSTED, MoveState::CANCEL])) {\n            throw new Exception(__('accounts::account-manager.post-action-validate.draft-state-required'));\n        }\n","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/aureuserp/aureuserp/blob/bd7cbeeb0c620985dfd9b88c56be7f3ea86be6b4/plugins/webkul/accounts/src/Services/MoveWorkflow.php#L233-L269","documentation":"Thrown from MoveWorkflow::assertPostable() (plugins/webkul/accounts/src/Services/MoveWorkflow.php:251) when the move's linked partner bank account (partnerBank relation) is soft-deleted (trashed()). Posting is blocked because the invoice would reference a removed bank account (typically printed on the document or used for payment). Message key: accounts::account-manager.post-action-validate.bank-archived.","triggerScenarios":"Posting a customer invoice whose selected recipient bank account (partner_bank_id) has since been archived (soft-deleted) — e.g. the bank record was archived between invoice creation and posting, or a stale draft references an old bank.","commonSituations":"Partner's old bank account archived during a bank migration while drafts still pointed at it; data cleanup archiving unused bank records that were still referenced by open drafts.","solutions":["Open the invoice and select an active bank account (or clear the bank field if not needed), then post.","Restore the archived bank account from trash if it must stay valid.","Before bulk-posting drafts, scan for partner_bank_id values pointing at trashed accounts and fix them."],"exampleFix":"// before: invoice references an archived bank\n$move->update(['partner_bank_id' => $archivedBank->id]);\napp(MoveWorkflow::class)->post($move); // throws bank-archived\n\n// after: point at an active bank or clear it\n$activeBank = $move->partner->bank_accounts()->whereNull('deleted_at')->first();\n$move->update(['partner_bank_id' => $activeBank?->id]);\napp(MoveWorkflow::class)->post($move);","handlingStrategy":"validation","validationCode":"if ($move->partnerBank?->trashed()) {\n    // pick an active bank account or clear partner_bank_id before posting\n}","typeGuard":"function moveBankAccountIsActive(AccountMove $move): bool\n{\n    return ! $move->partnerBank?->trashed();\n}","tryCatchPattern":"catch (Exception $e) when ($e->getMessage() === __('accounts::account-manager.post-action-validate.bank-archived')) { /* prompt to reselect an active bank account */ }","preventionTips":["Filter bank-account selectors to non-trashed records.","Warn when archiving a bank account still referenced by open drafts."],"tags":["move","posting","bank-account","soft-delete","accounts"],"backgroundTag":"archived-record-reference","analyzedSha":"bd7cbeeb0c620985dfd9b88c56be7f3ea86be6b4","analyzedAt":"2026-08-21T06:41:00.338Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}