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,MANAGERorSUPERVISOR. - The status is
Validated(and no reason asks for approval) orApproved. The buttonPostis grey otherwise. - You have read the lines. The version you post is the version you see.
Steps
- Open the adjustment.
- Check the columns
Current,Target,EffectandWould Refuse. A line with text inWould Refusewill be refused now. - 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:
- Locks the header, then checks the version (return code 40 on a stale one), then locks the lines.
- Checks the status:
Validatedwithout an approval need, orApproved. - 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
NoChangeand writes nothing. - Checks the direction of every changed line against its reason, on the change really made.
- If any line is refused, nothing is written and the answer names all refused lines.
- Writes one ledger row of type
Adjustfor each changed line, withqty_beforeandqty_after, the adjustment number asSource, the reason asreason_code, and the approver asauthorized_by. - Marks the lines
PostedorNoChangeand the documentPosted. - 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
| Result | Message |
|---|---|
| Posted | Adjustment {number} posted |
| Error | The adjustment was not posted: {error} |
The error text for the cases:
| Case | Message | Return code |
|---|---|---|
| Not validated | the adjustment is not validated | 70 |
| Needs approval | the adjustment's reason requires approval before posting | 70 |
| Posted already | a posted adjustment cannot be changed | 70 |
| 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 locking | the stock changed while the adjustment was being posted; post it again | 41 |
| Document changed since you opened it | version conflict on inventory_adjustment {id} | 40 |
| Same key, other request | An idempotency conflict | 42 |
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
| What | Change |
|---|---|
| Balances | Each changed line sets the quantity of its balance row to the target. |
| Ledger | One row of type Adjust for each changed line, quantity = the signed change. See Transactions. |
| Lines | Posted (with the ledger code) or NoChange. |
| Document | Posted, posted_by, posted_at. The version goes up. A posted document never changes again. |
| Events | process.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.
Related pages
- Adjustment header
- Validating an adjustment
- Adjustment reasons
- Return codes
- API:
inventory_adjustment_post(stateful command; version ofinventory_adjustment) - RF terminal: none.