Skip to content

Commit

Permalink
Merge pull request #174 from OpenLMIS-Angola/ANGOLASUP-909
Browse files Browse the repository at this point in the history
ANGOLASUP-909: resolving first request
  • Loading branch information
DominikNoga authored Sep 2, 2024
2 parents 6c31ffa + edf85df commit 5e14d44
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 5e14d44

Please sign in to comment.