Skip to content

Commit

Permalink
ANGOLASUP-909: resolving first request
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikNoga committed Sep 2, 2024
1 parent 6c31ffa commit edf85df
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,13 @@
});
}

function setItemsWithUnit() {
var itemsWithUnit = draft.lineItems.filter(function(item) {
return item.unit;
});
draft.lineItems = itemsWithUnit;
}

/**
* @ngdoc method
* @methodOf stock-physical-inventory-draft.controller:PhysicalInventoryDraftController
Expand All @@ -488,6 +495,7 @@
* Save physical inventory draft.
*/
vm.saveDraft = function(withNotification) {
setItemsWithUnit();
multiplyUnitsByFactor(draft.lineItems);
loadingModalService.open();
return physicalInventoryFactory.saveDraft(draft).then(function() {
Expand Down Expand Up @@ -614,7 +622,7 @@

draft.occurredDate = resolvedData.occurredDate;
draft.signature = resolvedData.signature;

setItemsWithUnit();
return saveLots(draft, function() {
physicalInventoryService.submitPhysicalInventory(draft).then(function() {
notificationService.success('stockPhysicalInventoryDraft.submitted');
Expand Down Expand Up @@ -888,10 +896,7 @@

function getUnitById(unitId) {
if (!unitId) {
return {
name: '-',
factor: 1
};
return undefined;
}

return vm.unitsOfOrderable.find(function(unit) {
Expand Down

0 comments on commit edf85df

Please sign in to comment.