Skip to content

Commit

Permalink
Add unit column in stock entry page
Browse files Browse the repository at this point in the history
  • Loading branch information
mbayopanda committed Jan 22, 2020
1 parent f7a9724 commit 9d84ea3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion client/src/modules/stock/entry/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ StockEntryController.$inject = [
*/
function StockEntryController(
Inventory, Notify, Session, util, bhConstants, ReceiptModal, Purchase,
StockForm, Stock, StockModal, uiGridConstants, Store, Uuid, $translate
StockForm, Stock, StockModal, uiGridConstants, Store, Uuid, $translate,
) {
// variables
let inventoryStore;
Expand Down Expand Up @@ -70,6 +70,13 @@ function StockEntryController(
cellTemplate : 'modules/stock/entry/templates/description.tmpl.html',
},

{
field : 'unit',
width : 150,
displayName : 'TABLE.COLUMNS.UNIT',
headerCellFilter : 'translate',
},

{
field : 'lot',
width : 150,
Expand Down Expand Up @@ -370,6 +377,7 @@ function StockEntryController(
item.quantity = items[index].balance || items[index].quantity;
item.cost = item.quantity * item.unit_cost;
item.expiration_date = new Date();
item.unit = inventory.unit;

if (vm.movement.entity.type === 'transfer_reception') {
item.lots.push({
Expand Down Expand Up @@ -594,6 +602,7 @@ function StockEntryController(
line.quantity = 0;
line.cost = line.quantity * line.unit_cost;
line.expiration_date = new Date();
line.unit = inventory.unit;
setInitialized(line);
}

Expand Down
4 changes: 2 additions & 2 deletions test/end-to-end/stock/stock.entry.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function StockEntryPage() {
* ]
*/
page.setLots = async function setLots(
inventoryRowNumber, lotsArray, isTransferReception, inventoryQuantity, inventoryUnitCost
inventoryRowNumber, lotsArray, isTransferReception, inventoryQuantity, inventoryUnitCost,
) {
// lots column
await this.openLotsModal(inventoryRowNumber);
Expand Down Expand Up @@ -145,7 +145,7 @@ function StockEntryPage() {
* open lot modal
*/
page.openLotsModal = async (inventoryRowNumber) => {
const launchLots = await GU.getCell(gridId, inventoryRowNumber, 3);
const launchLots = await GU.getCell(gridId, inventoryRowNumber, 4);
await launchLots.$('[data-lots]').click();
};

Expand Down

0 comments on commit 9d84ea3

Please sign in to comment.