Skip to main content

Delete Guardrails

Deletion in Vruksha ERP is soft (see Soft deletes) and is blocked when a record is still referenced by live downstream data. This protects referential integrity and the audit trail: you cannot delete something that other records depend on.

When a delete is blocked, the backend returns HTTP 409 Conflict with a message and, where applicable, a summary of the references that are blocking the delete. The remedy is almost always to deactivate, close, or cancel the record instead of deleting it.


Guardrail matrix

EntityDeletion is blocked when…Recommended alternative
PartyThe party is used as a buyer/seller/vendor in a Sales Order, Quotation, or Stock (party details).Deactivate the party instead.
PartnerThe partner is used in a Partnership, Project, Subproject, Unit shareholder holding, or Stock partnership.Deactivate the partner instead.
PartnershipThe partnership is referenced by a Project (and, more broadly, Stock or Unit ownership). Also blocked while the partnership is SUSPENDED or CLOSED.Change status to Closed instead.
StockThe stock is allocated to one or more projects (or has been split into child stocks).Cancel the acquisition (set status to CANCELLED) or unmap draft allocations first.
ProjectThe project has subprojects, units, or stock allocations.Change status to CANCELLED instead.
UnitThe unit is referenced by a Sales Order or Sales Invoice.Cancel/withdraw the unit instead of deleting.
QuotationStatus is not DRAFT/QUOTED, or a Sales Order is linked to it.Cancel the quotation instead.
Sales OrderStatus is not deletable (only early-stage SOs can be removed); referenced by invoices/payments.Cancel the SO (a reason is required).
Sales InvoiceStatus is not DRAFT, or the invoice has recorded payments.Cancel the invoice (a reason is required).

The matrix above reflects the reference checks implemented in each module's delete logic. Exact wording of the 409 message varies by module but always names the blocking references.


Per-entity detail

Party

A party cannot be deleted while it participates in any transaction. The controller documents the outcome directly: "Party is in use. Deactivate instead." Deactivation removes the party from selection lists while preserving its links to existing Sales Orders, Quotations, and Stock party details.

Partner

A partner cannot be deleted while it is "used in any Partnerships, Projects, Subprojects, Units, or Stock Partnerships." The delete returns 409 with a reference summary. Use deactivation to retire a partner without breaking ownership history.

Partnership

The partnerships module checks downstream references (projects, and broader stock/unit ownership) before allowing a delete. If referenced, it returns:

Partnership cannot be deleted because it is referenced by <…>. Suggestion: "Consider changing the status to Closed instead."

Additionally, a partnership that is already SUSPENDED or CLOSED cannot be deleted (or modified) — it is not operational.

Stock

A stock that is fully or partially allocated to a project is referenced downstream and cannot be deleted. A stock that has been split is terminal and locked. Unmap any DRAFT allocations first, or set the stock to CANCELLED.

Project

The projects module checks for subprojects, units, and stock allocations. If any exist:

Project has allocations and cannot be deleted. Suggestion: "Consider changing the status to CANCELLED instead."

The reference summary lists the counts (Subprojects, Units, Stock Allocations) that are blocking the delete.

Unit

Before deleting a unit, the system counts linked Sales Orders and Sales Invoices. If either is present, deletion is blocked and the dependencies are listed (e.g. "2 sales order(s)", "1 sales invoice(s)"). Withdraw/cancel the unit instead.

Quotation

Only DRAFT or QUOTED quotations can be deleted:

Cannot delete a quotation with status <…>. Only DRAFT or QUOTED quotations can be deleted.

Even a QUOTED/DRAFT quotation is blocked if a Sales Order is linked to it (409). Cancel the quotation instead — cancellation also auto-releases any held units.

Sales Invoice

Only DRAFT invoices can be deleted:

Cannot delete a Sales Invoice with status <…>. Only DRAFT Sales Invoices can be deleted.

An invoice with recorded payments cannot be deleted. Cancel the invoice (with a mandatory reason) instead.


How to resolve a blocked delete

  1. Read the 409 message and reference summary — it names exactly what is blocking the delete.
  2. Prefer the lifecycle alternative — deactivate (Party, Partner), close (Partnership), or cancel (Project, Quotation, Sales Order, Sales Invoice, Unit). These keep history intact and remove the record from active use.
  3. Or remove the blocking references first — for example, unmap DRAFT stock allocations from a project, then delete. This only works for early-stage, non-committed links.
  4. Never force-delete committed data — referenced transactional records (active SOs, issued invoices, registered units) are intentionally undeletable to preserve the audit trail.

Related: Status Lifecycles lists the terminal/cancellation states used as deletion alternatives, and Validation Rules explains soft deletes.