From f6adbd98026fd51af571136998c68386c6caf89b Mon Sep 17 00:00:00 2001 From: Daria Pionk <110475297+dariapionk@users.noreply.github.com> Date: Wed, 21 Sep 2022 11:44:07 +0200 Subject: [PATCH] SELV3-508: Fix error when submitting physical inventory (#4) * SELV3-508: Fix error when submitting physical inventory --- .../choose-date-modal.controller.js | 8 +++++--- .../physical-inventory-draft.controller.js | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/stock-choose-date-modal/choose-date-modal.controller.js b/src/stock-choose-date-modal/choose-date-modal.controller.js index e7561ca..acac3a9 100644 --- a/src/stock-choose-date-modal/choose-date-modal.controller.js +++ b/src/stock-choose-date-modal/choose-date-modal.controller.js @@ -28,13 +28,15 @@ .module('stock-choose-date-modal') .controller('ChooseDateModalController', controller); - controller.$inject = ['$filter', 'modalDeferred', 'authorizationService', 'minDate']; + controller.$inject = ['$filter', 'modalDeferred', 'authorizationService', 'minDate', '$location']; - function controller($filter, modalDeferred, authorizationService, minDate) { + function controller($filter, modalDeferred, authorizationService, minDate, $location) { var vm = this; // SELV3-507: Allow user to enter Shipment Date vm.minDate = minDate; - vm.maxDate = new Date(); + // SELV3-529: Fix error when submitting physical inventory + vm.maxDate = $location.absUrl().includes('physicalInventory') ? $filter('isoDate')(new Date()) : new Date(); + // SELV3-529: Ends here vm.occurredDate = vm.maxDate; vm.shipmentDate = vm.maxDate; vm.signature = ''; diff --git a/src/stock-physical-inventory-draft/physical-inventory-draft.controller.js b/src/stock-physical-inventory-draft/physical-inventory-draft.controller.js index 0e895b6..18b1109 100644 --- a/src/stock-physical-inventory-draft/physical-inventory-draft.controller.js +++ b/src/stock-physical-inventory-draft/physical-inventory-draft.controller.js @@ -700,6 +700,12 @@ return item.lot; }); + //SELV3-508: Fix error when submitting physical inventory + draft.lineItems.forEach(function(item) { + checkUnaccountedStockAdjustments(item); + }); + //SELV3-508: Ends here + vm.updateProgress(); var orderableGroups = orderableGroupService.groupByOrderableId(draft.lineItems);