Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
7.0.18-SNAPSHOT (WIP)
==================
Bug fixes:
* [OLMIS-8183](https://openlmis.atlassian.net/browse/OLMIS-8183): Fix NaN displayed in total losses and adjustments cell for new requisitions in packs mode.

7.0.17 / 2026-06-09
==================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@

function getDisplayedQuantity() {
return quantityUnitCalculateService.recalculateSOHQuantity(
vm.lineItem.totalLossesAndAdjustments, vm.lineItem.orderable.netContent,
vm.lineItem.totalLossesAndAdjustments || 0, vm.lineItem.orderable.netContent,
$scope.requisition.showInDoses()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,40 @@ describe('LossesAndAdjustmentsController', function() {
expect(vm.lineItem).toEqual($scope.lineItem);
});

describe('getDisplayedQuantity', function() {
beforeEach(function() {
$scope.lineItem = {
id: 'line-item-id',
stockAdjustments: [],
orderable: {
netContent: 10
}
};
$scope.requisition.showInDoses = function() {
return true;
};
vm.$onInit();
});

it('should return 0 when totalLossesAndAdjustments is undefined', function() {
vm.lineItem.totalLossesAndAdjustments = undefined;

expect(vm.getDisplayedQuantity()).toEqual(0);
});

it('should return 0 when totalLossesAndAdjustments is null', function() {
vm.lineItem.totalLossesAndAdjustments = null;

expect(vm.getDisplayedQuantity()).toEqual(0);
});

it('should return value when totalLossesAndAdjustments is set', function() {
vm.lineItem.totalLossesAndAdjustments = 12;

expect(vm.getDisplayedQuantity()).toEqual(12);
});
});

describe('showModal', function() {
beforeEach(function() {
spyOn(adjustmentsModalService, 'open').andReturn($q.when());
Expand Down
Loading