Skip to content

Commit

Permalink
Fixed: payload to pass shipmentItemSeqId for externally added item fo…
Browse files Browse the repository at this point in the history
…r a shipment(#357)
  • Loading branch information
ymaheshwari1 committed Mar 11, 2024
1 parent 70885d4 commit a329e24
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/store/modules/shipment/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ const actions: ActionTree<ShipmentState, RootState> = {
return Promise.reject("Missing locationSeqId on item")
}

if(!item.itemSeqId) {
return Promise.reject("Missing shipmentItemSeqId on item")
}

const params = {
shipmentId: payload.shipmentId,
facilityId: this.state.user.currentFacility.facilityId,
Expand Down Expand Up @@ -155,7 +159,14 @@ const actions: ActionTree<ShipmentState, RootState> = {
const resp = await ShipmentService.addShipmentItem(params);
if(resp.status == 200 && !hasError(resp)){
dispatch('updateProductCount', { shipmentId: resp.data.shipmentId })
if (!payload.shipmentId) commit(types.SHIPMENT_CURRENT_PRODUCT_ADDED, product)
if (!payload.shipmentId) {
// When adding item to a shipment from details page, then adding the shipmentItemSeqId to item level, as we do not generate shipmentItemSeqId app side,
// when adding an item to shipment
commit(types.SHIPMENT_CURRENT_PRODUCT_ADDED, {
...product,
itemSeqId: resp.data.shipmentItemSeqId
})
}
return resp;
} else {
showToast(translate('Something went wrong'));
Expand Down

0 comments on commit a329e24

Please sign in to comment.