Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: payload to pass shipmentItemSeqId for externally added item for a shipment(#357) #358

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/store/modules/shipment/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
return Promise.reject(new Error(err))
}
},
receiveShipmentItem ({ commit }, payload) {

Check warning on line 97 in src/store/modules/shipment/actions.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'commit' is defined but never used

Check warning on line 97 in src/store/modules/shipment/actions.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'commit' is defined but never used
return Promise.all(payload.items.map(async (item: any) => {
if(!item.locationSeqId) {
return Promise.reject("Missing locationSeqId on item")
Expand Down Expand Up @@ -153,9 +153,16 @@
locationSeqId: product.locationSeqId
}
const resp = await ShipmentService.addShipmentItem(params);
if(resp.status == 200 && !hasError(resp)){
if(resp.status == 200 && !hasError(resp) && resp.data.shipmentId && resp.data.shipmentItemSeqId) {
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
Loading