aureuserp/aureuserp · error · Exception

accounts::account-manager.post-action-validate.bank-archived

Error message

accounts::account-manager.post-action-validate.bank-archived

What it means

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.

Source

Thrown at plugins/webkul/accounts/src/Services/MoveWorkflow.php:251

                'name'    => $partner?->name,
            ],
        ];
    }

    public function assertPostable(AccountMove $move): void
    {
        if (! $move->partner_id) {
            if ($move->isSaleDocument(true)) {
                throw new Exception(__('accounts::account-manager.post-action-validate.customer-required'));
            }

            if ($move->isPurchaseDocument(true)) {
                throw new Exception(__('accounts::account-manager.post-action-validate.vendor-required'));
            }
        }

        if ($move->partnerBank?->trashed()) {
            throw new Exception(__('accounts::account-manager.post-action-validate.bank-archived'));
        }

        if (float_compare($move->amount_total, 0, precisionRounding: $move->currency->rounding) < 0) {
            throw new Exception(__('accounts::account-manager.post-action-validate.negative-amount'));
        }

        if (! $move->invoice_date) {
            if ($move->isSaleDocument(true)) {
                $move->invoice_date = now();
            } elseif ($move->isPurchaseDocument(true)) {
                throw new Exception(__('accounts::account-manager.post-action-validate.date-required'));
            }
        }

        if (in_array($move->state, [MoveState::POSTED, MoveState::CANCEL])) {
            throw new Exception(__('accounts::account-manager.post-action-validate.draft-state-required'));
        }

View on GitHub (pinned to bd7cbeeb0c)

Solutions

  1. Open the invoice and select an active bank account (or clear the bank field if not needed), then post.
  2. Restore the archived bank account from trash if it must stay valid.
  3. Before bulk-posting drafts, scan for partner_bank_id values pointing at trashed accounts and fix them.

Example fix

// before: invoice references an archived bank
$move->update(['partner_bank_id' => $archivedBank->id]);
app(MoveWorkflow::class)->post($move); // throws bank-archived

// after: point at an active bank or clear it
$activeBank = $move->partner->bank_accounts()->whereNull('deleted_at')->first();
$move->update(['partner_bank_id' => $activeBank?->id]);
app(MoveWorkflow::class)->post($move);
Defensive patterns

Strategy: validation

Validate before calling

if ($move->partnerBank?->trashed()) {
    // pick an active bank account or clear partner_bank_id before posting
}

Type guard

function moveBankAccountIsActive(AccountMove $move): bool
{
    return ! $move->partnerBank?->trashed();
}

Try / catch

catch (Exception $e) when ($e->getMessage() === __('accounts::account-manager.post-action-validate.bank-archived')) { /* prompt to reselect an active bank account */ }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of aureuserp/aureuserp@bd7cbeeb0c (2026-08-21). Data as JSON: /api/errors/bb2aab4ce2204707. Report an issue: GitHub.