Skip to content

Commit

Permalink
load expired lots only for loss
Browse files Browse the repository at this point in the history
  • Loading branch information
mbayopanda committed Jul 26, 2021
1 parent d220a19 commit 565846d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions client/src/modules/stock/exit/exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,12 @@ function StockExitController(
vm.movement.description = $translate.instant(mapExit[exitType.label].description);
vm.stockForm.store.clear();
vm.resetEntryExitTypes = false;

vm.overconsumption = [];

// reload inventories only if exit type has been selected previously
if (vm.depot) {
loadInventories(vm.depot);
}
}

function setupStock() {
Expand Down Expand Up @@ -286,8 +290,14 @@ function StockExitController(
function loadInventories(depot, dateTo = new Date()) {
setupStock();

const loadExpiredOnlyForLoss = vm.movement.exit_type === 'loss' ? undefined : 0;

vm.loading = true;
Stock.inventories.read(null, { depot_uuid : depot.uuid, dateTo })
Stock.inventories.read(null, {
depot_uuid : depot.uuid,
dateTo,
is_expired : loadExpiredOnlyForLoss,
})
.then(inventories => {
vm.selectableInventories = inventories.filter(item => item.quantity > 0);

Expand Down

0 comments on commit 565846d

Please sign in to comment.