Skip to content

Purchase Returns — Release Notes v1.0.1

Purchase Returns — Release Notes

Release date: 23 June 2026
Version: 1.0.1 (WMS patch) · Ailaaj One 1.4.3
Status: Live in production
Applies to: Replenish Stock → Procurement → Purchase Returns (create and edit)


What this release is

Staff completing a large purchase return (100+ lines) could hit a silent failure or a stuck Saving… button — the save looked frozen, stock could be wrong if validation failed mid-way, and there was no feedback on which batches had a problem.

This patch makes complete reliable and visible: inventory is loaded in safe batches, stock is validated before any deduction (including reserved quantity), problem rows are highlighted, and a progress dialog shows validating → saving items → updating stock → finalizing with a live counter.


Bug fixes

  • Large returns no longer fail with 502 / CORS errors. Inventory lookups for complete now run in batched queries instead of one oversized id=in.(…) URL that could exceed gateway limits (~150+ batch IDs).
  • Stock is validated before any deduction. Completing a return checks available qty (quantity_in − quantity_out − quantity_reserved) for every line and aggregates duplicate batches on the same inventory_id — no partial quantity_out updates when validation fails.
  • Reserved stock counts. Lines that look available on paper but are reserved for orders are blocked with a clear per-product message.
  • Missing error handling restored. WMS error codes and messages display correctly when save fails (no more blank WMS_ERROR_MESSAGES is not defined crashes).
  • Problem rows highlighted. Lines that fail stock validation are marked on the edit screen so staff can fix qty or remove duplicates before retrying.

Improvements

  • Save progress dialog on create and edit — a modal shows the current phase (Validating stock · Saving items · Updating stock · Finalizing return), X / Y progress, percentage bar, and a short message (e.g. Saving item 45 of 139…). The dialog cannot be dismissed while save is in progress.
  • Saving state on the button — Create / Save shows Saving… and is disabled while work is in flight.

Safety net (behaviour)

StepWhat happens
Draft saveNo inventory movement
CompleteValidate all lines → save return + items → update stock per batch → mark completed
Validation failureNo stock deducted; return stays draft; toast lists affected products
Gateway / save errorReturn stays draft; staff can retry after fixing data

Known issues / notes

  • Completing a very large return (100+ unique batches) can still take a minute because stock updates run one batch at a time — the progress dialog shows activity, but total time is unchanged.
  • If a return was left in a bad state from an older failed complete (draft with stock already moved), contact support — a one-off data repair may be required before complete succeeds.