Skip to main content

Edit Purchase Order

What it is

Changes an existing LPO: its supplier, date, currency, notes and the whole set of line items. It is the only screen that can add a line to an order that already exists.

Unlike Create LPO, this screen saves through an API route rather than writing to the database from the browser — which is what makes the rules below impossible to skip.

This screen has no Feature ID of its own. The order it edits is A2Z-F146 — PO detail.

Who can open it

Any signed-in staff account that is active, subject to the same two gates as the Purchase Orders list — an active account, and the ops.purchase-orders feature grant while FEATURE_GRANULAR_RBAC is on. The owner bypasses the grant.

Opening it is not the same as being allowed to save. Four conditions close an order to editing, and when one applies this screen shows only the reason and a link back:

The order…You will see
was retracted"This purchase order was retracted and cannot be edited."
has been signed"This purchase order has been signed and cannot be edited."
is out for signature"This purchase order is out for signature. Reject the signature request before editing it."
has goods received against it — Delivery State is partial or complete"Goods have been received against this purchase order, so it can no longer be edited."

A signed order that has also been received reads as signed, because that is the harder of the two to undo.

🔴 The last of these is the one that catches people. Delivery State is set from a small dropdown on the Purchase Orders list, with no warning that it locks editing. Setting it back to Open on that list re-opens this screen — the lock is judged fresh each time you save.

Before you start

The PO number cannot be changed here, and neither can the entity. The number is shown greyed out, and the save deliberately does not send either value. Changing either would make it a different order rather than an edit of this one; raise a new LPO instead.

⚠️ A line with no description is dropped on save without telling you — the same behaviour as the create screen. Fill the description in, or remove the row.

⚠️ Currency is a free-text box here. The create screen offers AED, USD and INR from a dropdown; this one accepts anything up to eight characters. Type the code carefully — nothing checks it against a list.

Every control on the page

Header fields, four across:

ControlWhat it does
SupplierEvery supplier you can see, alphabetically. The supplier must be one your permissions let you see, or the save is refused
PO DateThe order date
CurrencyFree text, up to eight characters
PO NumberGreyed out and read-only. Shown for reference only

Notes — free text, three rows.

The items table — Description, Qty, Unit, Unit Cost, Line Total, and a × per row:

  • Line Total is calculated as you type and cannot be edited.
  • × removes the row. Removing the only row leaves an empty row rather than none — an order with no lines cannot be saved anyway.
  • + Add Row adds a blank line (quantity 1, unit EA, cost 0).
  • The running total sits opposite + Add Row, in the currency you typed above.

Save Changes writes the order. Cancel returns to the order without saving.

What it writes

Save Changes calls PUT /api/purchase-orders/[id], which:

  • re-checks the four lock conditions above and refuses with the reason if any now applies;
  • checks the chosen supplier is one you may see, and refuses if not;
  • updates purchase_orders — supplier, date, currency, notes and the order total;
  • replaces the line items wholesale in po_items: every existing line for this order is deleted and the lines on screen are inserted in their place. That is why a row you removed actually disappears;
  • writes an update row to the activity log.

🔴 The money is recalculated on the server from quantity × unit cost. The totals this screen shows are for your benefit only — whatever the browser sends as a total is ignored. These figures reach supplier documents, so they are not taken on trust from a browser.

⚠️ The header is saved before the lines. If the lines then fail to write, you are told so explicitly — "Line items could not be saved: … The purchase order now has no line items." — and the order really is left with none. Re-enter the lines and save again.

When it goes wrong

The page shows only a sentence and a link back. The order is locked; the sentence says which of the four reasons applies. See the table above for what to do about each.

"Goods have been received against this purchase order…" and you know they have not. The Delivery State dropdown on the Purchase Orders list is at partial or complete. Set it back to Open and reopen this screen.

"Supplier, date and currency are required." One of the three header fields is empty.

"Add at least one line item with a description." Every row is missing its description.

"Supplier not found or access denied." The supplier you picked is outside what your permissions cover.

"Line items could not be saved: … The purchase order now has no line items." Exactly what it says. The header change was kept; the lines were not. Re-enter them and save again before anyone sends this order out.

"Purchase order not found." The order does not exist, or it belongs to an entity your permissions do not cover.

  • Purchase Order — where ✎ Edit Record comes from, and where Cancel returns you.
  • Purchase Orders — the list, and the Delivery dropdown that locks this screen.
  • Create LPO — raising a new order instead of editing this one.