Skip to content

Commit

Permalink
Enable caching of excludeZeroValue flag in Stock Value Report generat…
Browse files Browse the repository at this point in the history
…ion dialog
  • Loading branch information
jmcameron committed Feb 3, 2021
1 parent db55809 commit d4ef434
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ function StockValueConfigController($sce, Notify, SavedReports,
const cache = new AppCache('configure_stock_value_report');
const reportUrl = 'reports/stock/value';

// Default values
vm.previewGenerated = false;
vm.orderByCreatedAt = 0;
vm.dateTo = new Date();
vm.excludeZeroValue = 0;

vm.onDateChange = (date) => {
vm.dateTo = date;
Expand Down Expand Up @@ -46,12 +48,16 @@ function StockValueConfigController($sce, Notify, SavedReports,
vm.currency_id = currency.id;
};

vm.onExcludeZeroValue = () => {
vm.reportDetails.exclude_zero_value = vm.excludeZeroValue;
};

function formatData() {
const params = {
depot_uuid : vm.depot.uuid,
dateTo : vm.dateTo,
currency_id : vm.currency_id,
exclude_zero_value : vm.reportDetails.excludeZeroValue,
exclude_zero_value : vm.reportDetails.exclude_zero_value,
};
cache.reportDetails = angular.copy(params);
params.dateTo = moment(params.dateTo).format('YYYY-MM-DD');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ <h3 translate>REPORT.STOCK_VALUE.TITLE</h3>
<hr>
<div class="checkbox">
<label>
<input type="checkbox" ng-true-value="1" ng-false-value="0" ng-model="ReportConfigCtrl.reportDetails.excludeZeroValue">
<input type="checkbox" ng-true-value="1" ng-false-value="0"
ng-model="ReportConfigCtrl.excludeZeroValue"
ng-change="ReportConfigCtrl.onExcludeZeroValue()">
<span translate>REPORT.STOCK_VALUE.EXCLUDE_INVENTORIES_ZERO_VALUE</span>
</label>
</div>
Expand Down
1 change: 1 addition & 0 deletions server/controllers/stock/reports/stock/value.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ async function reporting(_options, session) {
data.emptyResult = data.stockValues.length === 0;

data.currency_id = options.currency_id;
data.exclude_zero_value = options.exclude_zero_value;
return report.render(data);
}

Expand Down

0 comments on commit d4ef434

Please sign in to comment.