Skip to content

Commit

Permalink
Add option to display negative quantities
Browse files Browse the repository at this point in the history
  • Loading branch information
mbayopanda committed Nov 25, 2020
1 parent 93e7dd9 commit 2461429
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions client/src/i18n/en/stock.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@
"ASSIGNMENT_CURRENT":"Current",
"NO_ASSIGNMENT":"No Assignment",
"INCLUDE_EXHAUSTED_LOTS":"Include exhausted lots",
"INCLUDE_EMPTY_OR_NEGATIVE_LOTS" : "Include exhausted or negative lots",
"INCLUDE_ONLY_EXHAUSTED_LOTS": "Include only exhausted lots",
"CLICK_TO_SEE":"Click here to see lots",
"SHOW_WARNINGS":"Click to show Warnings",
Expand Down
1 change: 1 addition & 0 deletions client/src/i18n/fr/stock.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"GROUPING" : "Groupage",
"JOIN_INVOICE" : "Joindre une facture",
"INCLUDE_EMPTY_LOTS" : "Inclure les lots épuisés",
"INCLUDE_EMPTY_OR_NEGATIVE_LOTS" : "Inclure les lots épuisés ou négatives",
"INCLUDE_EMPTY_LOTS_HELP" : "Afficher les articles dont la quantité est zero",
"INCREASE" : "Augmentation",
"INCREASE_HELP" : "Ajustement de stock en augmentant la quantité des lots des produits en stock",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ <h3 translate>INVENTORY_ADJUSTMENT.TITLE</h3>
<bh-filter-toggle on-toggle="StockCtrl.toggleInlineFilter()">
<span translate>FORM.LABELS.FILTER</span>
</bh-filter-toggle>
<div class="toolbar-item">
<div class="checkbox">
<label>
<input
type="checkbox"
name="includeEmptyLot"
ng-true-value="1"
ng-false-value="0"
ng-model="StockCtrl.includeEmptyLot"
ng-change="StockCtrl.reloadInventories()">
<span translate>STOCK.INCLUDE_EMPTY_OR_NEGATIVE_LOTS</span>
</label>
</div>
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,17 @@ function StockInventoryAdjustmentController(
}

// ============================ Inventories ==========================
vm.reloadInventories = () => {
loadInventories(vm.depot);
};

function loadInventories(depot) {
vm.loading = true;
setupStock();

Stock.lots.read(null, {
depot_uuid : depot.uuid,
includeEmptyLot : 0,
includeEmptyLot : vm.includeEmptyLot || 0,
dateTo : vm.movement.date,
})
.then(lots => {
Expand Down
2 changes: 1 addition & 1 deletion server/controllers/stock/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ async function createInventoryAdjustment(req, res, next) {
lot_uuid : db.bid(lot.uuid),
depot_uuid : db.bid(movement.depot_uuid),
document_uuid : db.bid(positiveAdjustmentUuid),
quantity : lot.oldQuantity,
quantity : lot.oldQuantity * -1,
unit_cost : lot.unit_cost,
date : new Date(movement.date),
entity_uuid : movement.entity_uuid,
Expand Down

0 comments on commit 2461429

Please sign in to comment.