Skip to main content

Adjustment header

The header is the top part of the adjustment document. It holds the reason, the comment and the status, and it has the buttons that move the document forward: Validate, Approve, Post, Reverse. The document is the shell inventory_adjustment_shell_form: the header form inventory_adjustment_normal_form (30 percent of the height) and the lines list (70 percent). The data object is inventory_adjustment_doc. The header is loaded by inventory_adjustment_card_get.

You get here by pressing New or by clicking a row of the Adjustments list.

Fields​

LabelColumnTypeRequiredAllowed values and defaultWhat it does
Numberadjustment_numberText, up to 20 characters. Unique.Yes (set for you)A new document gets ADJ and 7 digits from the counter. Always read only.The key of the document.
StatusstatusTextYesDraft (new), Validated, Approved, Posted. Always read only.Where the document is in its life.
Reasonreason_codeDrop-downYesA value of the code list inv_adjust_reason (code list id 1031). A retired value is refused at Save. The value REVERSAL is refused for a hand-made document.Says why the stock changes, and what the document may do. See Adjustment reasons.
VersionversionWhole numberYesStarts at 1. Read only.The version counter.
CommentcommentText, up to 500 charactersSometimesAny text. Required when the reason of the header asks for a comment.A free note.
Sourcesource_typeTextYesManual for a document made here. Read only.Where the document came from.
Needs Approvalneeds_approvalCheck box, read onlySet by the system.On when any reason used by the document (the header's or a line's) asks for approval.
Validated Atvalidated_atDate and time, read onlyEmpty until validated.When it was validated.
Approved Atapproved_atDate and time, read onlyEmpty until approved.When it was approved.
Posted Atposted_atDate and time, read onlyEmpty until posted.When it was posted.
Reversal Ofreversal_of_numberText, read onlyEmpty unless this document is a reversal.The number of the document this one reverses.
Reversed Byreversed_by_numberText, read onlyEmpty unless this document was reversed.The number of the document that reverses this one.

Reason and Comment can be edited only while the status is Draft, Validated or Approved (generic_field_gate). Number, Status, Version and the others never.

Sources: the form in crates/libs/wms-lib-sql/sql/wms-meta-ui/migrations/088_inventory_adjustment_screens.sql and 089_inventory_adjustment_ordinary_forms.sql; the document service in crates/libs/wms-inventory/src/service/inventory_adjustment/.

Toolbar buttons​

ButtonEnabled whenWhat it doesTask page
SaveStatus is Draft, Validated or ApprovedCreates the document (first time) or saves Reason and Comment. Saving the same effective values leaves the current status and validation evidence unchanged.Creating an adjustment
ValidateStatus is Draft, Validated or ApprovedJudges every line without changing stock.Validating an adjustment
ApproveStatus is ValidatedApproves the document.Approving an adjustment
PostThe document is postable: Validated and no reason needs approval, or ApprovedSets the stock of every line to its target.Posting an adjustment
ReverseThe document is posted and has not been reversedMakes a new draft that sets the stock back.Reversing an adjustment
DeleteStatus is Draft, Validated or Approved, and the document is savedDeletes the document and its lines.Deleting an adjustment

The grey texts are: Validate: A posted adjustment cannot be validated again. Approve: Only a validated adjustment is approved. Post: Validate the adjustment, and approve it when its reason asks. Reverse: Only a posted adjustment is reversed, and only once. Delete: A posted adjustment is not deleted: reverse it (a new, unsaved document: Save the adjustment first). Save: A posted adjustment cannot be changed.

Rules of the header​

  • Saving a new document needs a usable Reason: it must be on the list and active. Messages: reason {reason} is not on the adjustment reason list, reason {reason} is retired.
  • When the header's reason asks for a comment, Comment must not be empty at Save: reason {reason} requires a comment. This is checked at Save, not only at Validate.
  • A hand-made document cannot use the reason REVERSAL: a reversal is made from the posted adjustment it reverses, not by hand. A reversal keeps its reason and no other document takes it: a reversal keeps its reason, and no other adjustment takes it.
  • The number may be at most 20 characters: an adjustment number is at most 20 characters.
  • Changing Reason or Comment on a document that is Validated or Approved puts it back to Draft and clears the verdicts of all lines. Saving the same effective values is a no-op: status, version, validation, approval and line verdicts stay as they were. (crates/libs/wms-inventory/src/service/inventory_adjustment/update_header.rs; adding, changing or removing a line is always a content change.)
  • Approve, Post and Delete send the version of the header. A stale version is refused with return code 40.

Messages after a button​

ButtonSuccessFailure
Validate{summary}: Adjustment {number} is Validated, or Adjustment {number} is not validated: line {n} — {reason}; ... (the first 3 refused lines, then and {n} more)The adjustment was not validated: {error}
ApproveAdjustment {number} approvedThe adjustment was not approved: {error}
PostAdjustment {number} postedThe adjustment was not posted: {error}
ReverseReversal {number} made: open it, say why on its header, validate and post itThe adjustment was not reversed: {error}
DeleteAdjustment {number} deletedThe adjustment was not deleted: {error}

If the id or the version is not known: Reopen the adjustment: its id is unknown, Reopen the adjustment: its version is unknown.

What it affects​

  • Post changes stock and writes the ledger. See Posting an adjustment.
  • Post sends the event process.inventory.adjusted (one per document). For each location whose reason asks for a count it also sends process.inventory.count_requested. See Posting an adjustment.

Who can use it​

ADMIN, MANAGER and SUPERVISOR for everything except Approve; Approve is ADMIN and MANAGER only. See Who can do what.

  • Adjustments list
  • Adjustment lines
  • Adjustment statuses and transitions
  • Return codes
  • API: inventory_adjustment_card_get, create_inventory_adjustment, update_inventory_adjustment (stateful, version of inventory_adjustment), inventory_adjustment_validate (stateless), inventory_adjustment_approve (stateful), inventory_adjustment_post (stateful), inventory_adjustment_reverse (stateless), inventory_adjustment_delete (stateful)
  • RF terminal: none.