Skip to content

Commit

Permalink
Small fixes for asset entry
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcameron committed Mar 2, 2022
1 parent e5fec50 commit 8020acf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
10 changes: 5 additions & 5 deletions client/src/modules/stock/assign/modals/action.modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class="form-group"
ng-class="{ 'has-error' : ModalForm.$submitted && ModalForm.inventory_uuid.$invalid }">
<label class="control-label" translate>STOCK.INVENTORY</label>
<ui-select
<ui-select
name="inventory_uuid"
ng-model="$ctrl.inventory_uuid"
on-select="$ctrl.onSelectInventory($item)"
Expand All @@ -47,8 +47,8 @@
class="form-group"
ng-class="{ 'has-error' : ModalForm.$submitted && ModalForm.lot_uuid.$invalid }">
<label class="control-label" translate>STOCK.LOT</label>
<ui-select
name="lot_uuid"
<ui-select
name="lot_uuid"
ng-model="$ctrl.model.lot_uuid"
on-select="$ctrl.onSelectLot($item)"
ng-required="true"
Expand All @@ -59,15 +59,15 @@
<ui-select-choices ui-select-focus-patch repeat="l.uuid as l in $ctrl.availableLots | filter: { 'label': $select.search }">
<span ng-bind-html="l.label | highlight:$select.search"></span>
</ui-select-choices>
</ui-select>
</ui-select>

<div class="help-block" ng-messages="ModalForm.lot_uuid.$error" ng-show="ModalForm.$submitted">
<div ng-messages-include="modules/templates/messages.tmpl.html"></div>
</div>
</div>

<!-- entity -->
<bh-entity-select
<bh-entity-select
entity-uuid="$ctrl.model.entity_uuid"
on-select-callback="$ctrl.onSelectEntity(entity)"
required="true">
Expand Down
6 changes: 5 additions & 1 deletion client/src/modules/stock/entry/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,9 @@ function StockEntryController(
stockLine.tracking_expiration = inventory.tracking_expiration;
stockLine.unique_item = inventory.unique_item;
stockLine.is_asset = inventory.is_asset;
if (inventory.is_asset) {
stockLine.quantity = 1;
}

StockModal.openDefineLots({
stockLine,
Expand Down Expand Up @@ -712,7 +715,8 @@ function StockEntryController(
line.code = inventory.code;
line.label = inventory.label;
line.unit_cost = inventory.price;
line.quantity = 0;
line.is_asset = inventory.is_asset;
line.quantity = inventory.is_asset ? 1 : 0;
line.cost = line.quantity * line.unit_cost;
line.expiration_date = entryDate;
line.unit = inventory.unit;
Expand Down
1 change: 1 addition & 0 deletions client/src/modules/stock/entry/modals/lots.modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

<input
ng-if="$ctrl.isCostEditable"
ng-disabled="$ctrl.stockLine.is_asset"
class="form-control"
type="number"
ng-change="$ctrl.onChangeQuantity()"
Expand Down

0 comments on commit 8020acf

Please sign in to comment.