Skip to main content

Posting an adjustment

Use this page to make the stock equal to the targets of the document. Post is the only step that changes stock. It is all or nothing: if one line is refused, no line is posted.

Before you start​

  • You are ADMIN, MANAGER or SUPERVISOR.
  • The status is Validated (and no reason asks for approval) or Approved. The button Post is grey otherwise.
  • You have read the lines. The version you post is the version you see.

Steps​

  1. Open the adjustment.
  2. Check the columns Current, Target, Effect and Would Refuse. A line with text in Would Refuse will be refused now.
  3. Click Post.

What the server does​

inventory_adjustment_post (crates/libs/wms-inventory/src/service/inventory_adjustment/post.rs) works in one transaction, in this order:

  1. Locks the header, then checks the version (return code 40 on a stale one), then locks the lines.
  2. Checks the status: Validated without an approval need, or Approved.
  3. For every line: finds the balance row of the identity, and sets its quantity to the target. Lines that create stock make a new balance row. A line already at its target is NoChange and writes nothing.
  4. Checks the direction of every changed line against its reason, on the change really made.
  5. If any line is refused, nothing is written and the answer names all refused lines.
  6. Writes one ledger row of type Adjust for each changed line, with qty_before and qty_after, the adjustment number as Source, the reason as reason_code, and the approver as authorized_by.
  7. Marks the lines Posted or NoChange and the document Posted.
  8. Writes the events (below).

The balances are locked in one statement, ordered by id, so two documents do not wait on each other.

What the screen says​

ResultMessage
PostedAdjustment {number} posted
ErrorThe adjustment was not posted: {error}

The error text for the cases:

CaseMessageReturn code
Not validatedthe adjustment is not validated70
Needs approvalthe adjustment's reason requires approval before posting70
Posted alreadya posted adjustment cannot be changed70
Lines refused{n} adjustment line(s) cannot be posted. The lines are in the answer with their codes. The codes are the ones in Validating an adjustment.0
Stock appeared while lockingthe stock changed while the adjustment was being posted; post it again41
Document changed since you opened itversion conflict on inventory_adjustment {id}40
Same key, other requestAn idempotency conflict42

Not confirmed by code: how the window shows the refused lines (the answer carries them in context.lines; the message line shows only the first part). To verify: post a document with a refused line and read the screen.

What changes​

WhatChange
BalancesEach changed line sets the quantity of its balance row to the target.
LedgerOne row of type Adjust for each changed line, quantity = the signed change. See Transactions.
LinesPosted (with the ledger code) or NoChange.
DocumentPosted, posted_by, posted_at. The version goes up. A posted document never changes again.
Eventsprocess.inventory.adjusted, one for the document, with the changed lines and the approver. For each location named by a changed line whose reason says Count After Posting (not for a document made by a count): process.inventory.count_requested with source Adjustment.

An adjustment never touches allocated or picked stock: a target below qty_allocated + qty_picked is refused (BELOW_RESERVED_QTY).

Undoing a post​

A posted document cannot be edited or deleted. Use Reversing an adjustment.