UPDATING PURCHASE ORDER ITEM QUANTITY ON THE BASIS OF THE SAVED SEARCH PENDING QUANTITY VALUE

This proposal covers the scope of updating the purchase order item quantity on the basis of the saved search pending QTYS column value.

Requirement

Create a script that takes that item and subtracts the quantity from the “Pending Qty” column. So, if the order is 5 and the pending qty is 1, You delete one quantity from the order quantity field. When this is completed, the order will be marked as “PENDING BILLING”.

Our Solution

  1. To achieve the functionality, we will write a map-reduce script.
  2. Using the script, we will retrieve results from the saved search (search id: customsearch14302).
  3. We will group the search result based on the PO internal id. Because a single PO contains multiple items for processing.
  4. We will identify the items in PO using their SKU value.
  5. If the result SKU and item SKU are equal. We will compare the item quantity and Pending quantity value.
  6. We will deduct the pending QTYS item from the quantity order.
  7. If the deducted value is greater than -1, the deducted value will be used in place of the order quantity.

Sample scenario

  1. Order quantity = 3 and Pending QTYS = 2

Order quantity – Pending QTYS (3-2) = 1

1 will be set as a new order quantity.

  1. Order quantity = 2 and Pending QTYS = 3

Order quantity – Pending QTYS (2-3) = -1

We will not consider this item for updating the order quantity.

Following this change, the purchase order status will be pending billing and will be removed from the search.

Assumption

  1. We mapped the order items to the saved search results using item SKU.
  2. We assume that the PO does not have the same items on multiple lines.

Risk

  1. The update will directly need to work in production.
  2. We need 3 test purchase orders for the development. This order needs to be listed in the saved search.

Leave a comment

Your email address will not be published. Required fields are marked *