Skip to content

Commit

Permalink
fix(stock): only add line if no line expected
Browse files Browse the repository at this point in the history
This commit fixes the stock entry form to only add values no values are
expected to be populated from the stock entry type component.
  • Loading branch information
jniles committed Feb 8, 2018
1 parent ae83df9 commit 7da7ead
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 6 additions & 3 deletions client/src/modules/stock/entry/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ function StockEntryController(
mapEntry[entryType.label].find();

vm.entryOption = entryType && entryType.label !== 'purchase';
if (vm.gridOptions.data.length === 0) {
vm.addItems(1);
}
}

// set initialized to true on the passed item
Expand Down Expand Up @@ -239,11 +236,17 @@ function StockEntryController(
function handleIntegrationSelection() {
var description = $translate.instant('STOCK.RECEPTION_INTEGRATION');
initSelectedEntity(description);
if (vm.gridOptions.data.length === 0) {
vm.addItems(1);
}
}

function handleDonationSelection() {
var description = $translate.instant('STOCK.RECEPTION_DONATION');
initSelectedEntity(description);
if (vm.gridOptions.data.length === 0) {
vm.addItems(1);
}
}

// fill the grid with the inventory contained in the purchase order
Expand Down
2 changes: 0 additions & 2 deletions test/end-to-end/stock/stock.entry.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ function StockEntryTests() {
{ label : 'ASP-FIVE', quantity : 500, expiration_date : '2022-09-15' },
];

page.addRows(1);

page.setItem(0, 'Quinine');

page.setLots(0, lots, false, 1500, 0.09);
Expand Down

0 comments on commit 7da7ead

Please sign in to comment.