Skip to content

Commit

Permalink
feat(server): Posting adjustement stock data to the journal through v…
Browse files Browse the repository at this point in the history
…oucher
  • Loading branch information
DedrickEnc committed Oct 20, 2017
1 parent 419bb0c commit 5a7ab79
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
6 changes: 2 additions & 4 deletions client/src/modules/stock/adjustment/adjustment.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,8 @@ <h4><i class="fa fa-arrow-circle-down"></i> <span translate>STOCK.DECREASE</span
<bh-add-item
disable = "StockCtrl.adjustmentOption"
callback = "StockCtrl.addItems(numItem)">
</bh-add-item>

</div>

</bh-add-item>
</div>
</div>

<!-- grid -->
Expand Down
3 changes: 1 addition & 2 deletions client/src/modules/stock/adjustment/adjustment.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,9 @@ function StockAdjustmentController(
if (form.$invalid || !vm.adjustmentOption) { return; }

if (vm.adjustmentOption === 'increase') {
vm.adjustmentType = 'FORM.LABELS.INCREASE';
isExit = 0;
fluxId = bhConstants.flux.FROM_ADJUSTMENT;
} else if (vm.adjustmentOption === 'decrease') {
vm.adjustmentType = 'FORM.LABELS.DECREASE';
isExit = 1;
fluxId = bhConstants.flux.TO_ADJUSTMENT;
}
Expand Down Expand Up @@ -231,6 +229,7 @@ function StockAdjustmentController(
})
.catch(Notify.handleError);
}

function changeDepot() {
return Depots.openSelectionModal(vm.depot)
.then(function (depot) {
Expand Down
10 changes: 4 additions & 6 deletions server/controllers/stock/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,10 @@ function normalMovement(document, params, metadata) {
transaction.addQuery('CALL ComputeMovementReference(?);', [db.bid(document.uuid)]);
});

if (isStockExit) {
const projectId = metadata.project.id;
const currencyId = metadata.enterprise.currency_id;
const postStockParameters = [db.bid(document.uuid), parameters.is_exit, projectId, currencyId];
transaction.addQuery('CALL PostStockMovement(?, ?, ?, ?);', postStockParameters);
}
const projectId = metadata.project.id;
const currencyId = metadata.enterprise.currency_id;
const postStockParameters = [db.bid(document.uuid), parameters.is_exit, projectId, currencyId];
transaction.addQuery('CALL PostStockMovement(?, ?, ?, ?);', postStockParameters);

return transaction.execute();
}
Expand Down

0 comments on commit 5a7ab79

Please sign in to comment.