Skip to content

Commit

Permalink
Merge pull request #167 from OpenLMIS-Angola/OAM-273-frontend
Browse files Browse the repository at this point in the history
OAM-273: fix for counting quantity
  • Loading branch information
olewandowski1 authored Aug 8, 2024
2 parents 0111379 + 19c6b91 commit c8e4a3c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/stock-adjustment-creation/adjustment-creation.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,6 @@

function onSubmit() {
loadingModalService.open();

var addedLineItems = angular.copy(vm.addedLineItems);

generateKitConstituentLineItem(addedLineItems);
Expand All @@ -733,7 +732,6 @@
distinctLots = [];

addedLineItems.forEach(function(lineItem) {
lineItem.quantity = vm.getLineItemTotalQuantity(lineItem);
// OAM-273: add unitOfOrderableId to body of line items for unpack view.
lineItem.unitOfOrderableId = lineItem.unit.id;
// OAM-273: end
Expand Down Expand Up @@ -950,13 +948,15 @@
var constituentLineItems = [];

addedLineItems.forEach(function(lineItem) {
lineItem.quantity = vm.getLineItemTotalQuantity(lineItem);
lineItem.orderable.children.forEach(function(constituent) {
constituent.reason = creditReason;
constituent.occurredDate = lineItem.occurredDate;
if (lineItem.unit.id === constituent.unit.id) {
constituent.quantity = lineItem.quantity * constituent.quantity;
}
constituentLineItems.push(constituent);
var newConstituent = JSON.parse(JSON.stringify(constituent));

newConstituent.reason = creditReason;
newConstituent.occurredDate = lineItem.occurredDate;
newConstituent.quantity = lineItem.quantity * constituent.quantity * constituent.unit.factor;

constituentLineItems.push(newConstituent);
});
});

Expand Down

0 comments on commit c8e4a3c

Please sign in to comment.