From b83b64877713c4437c51a8454c2bfa73b13d3bf9 Mon Sep 17 00:00:00 2001 From: DominikNoga Date: Tue, 5 Nov 2024 13:37:18 +0100 Subject: [PATCH] Enabled new lot edition in receive view --- src/stock-edit-lot-modal/edit-lot-modal.controller.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/stock-edit-lot-modal/edit-lot-modal.controller.js b/src/stock-edit-lot-modal/edit-lot-modal.controller.js index 922f189..91fc091 100644 --- a/src/stock-edit-lot-modal/edit-lot-modal.controller.js +++ b/src/stock-edit-lot-modal/edit-lot-modal.controller.js @@ -119,7 +119,9 @@ if (noErrors) { selectedItem.lot = vm.newLot; selectedItem.displayLotMessage = vm.newLot.lotCode; - physicalInventoryDraftCacheService.cacheDraft(draft); + if (draft.lineItems) { + physicalInventoryDraftCacheService.cacheDraft(draft); + } modalDeferred.resolve(); } } @@ -160,7 +162,11 @@ * Validate if on line item list exists the same orderable with the same lot code */ function validateLotCode() { - draft.lineItems.forEach(function(lineItem) { + var items = vm.allLineItems; + if (draft.lineItems) { + items = draft.lineItems; + } + items.forEach(function(lineItem) { if (lineItem.orderable.productCode === vm.selectedItem.orderable.productCode && lineItem.lot && vm.selectedItem.lot && vm.selectedItem.lot.lotCode === lineItem.lot.lotCode && !(vm.selectedItem.lot.lotCode === selectedItem.lot.lotCode)) {