diff --git a/client/src/modules/reports/generate/stock_changes/stock_changes.config.js b/client/src/modules/reports/generate/stock_changes/stock_changes.config.js
deleted file mode 100644
index 926698b7f0..0000000000
--- a/client/src/modules/reports/generate/stock_changes/stock_changes.config.js
+++ /dev/null
@@ -1,73 +0,0 @@
-angular.module('bhima.controllers')
- .controller('stock_changesController', StockChangesReportConfigCtrl);
-
-StockChangesReportConfigCtrl.$inject = [
- '$sce', 'NotifyService', 'BaseReportService', 'AppCache', 'reportData', '$state',
- 'LanguageService',
-];
-
-function StockChangesReportConfigCtrl($sce, Notify, SavedReports, AppCache, reportData, $state, Languages) {
- const vm = this;
-
- const cache = new AppCache('stock_changes');
- const reportUrl = 'reports/stock/changes';
-
- // default values
- vm.reportDetails = {};
- vm.previewGenerated = false;
-
- // check cached configuration
- checkCachedConfiguration();
-
- vm.onSelectFiscalYear = year => {
- vm.reportDetails.fiscal_id = year.id;
- };
-
- vm.onSelectPeriod = period => {
- vm.reportDetails.period_id = period.id;
- };
-
- vm.onSelectDepot = depot => {
- vm.reportDetails.depot_uuid = depot.uuid;
- };
-
- vm.clearPreview = () => {
- vm.previewGenerated = false;
- vm.previewResult = null;
- };
-
- vm.preview = form => {
- if (form.$invalid) {
- return 0;
- }
-
- // update cached configuration
- cache.reportDetails = angular.copy(vm.reportDetails);
- angular.extend(vm.reportDetails, { lang : Languages.key });
-
- return SavedReports.requestPreview(reportUrl, reportData.id, angular.copy(vm.reportDetails))
- .then((result) => {
- vm.previewGenerated = true;
- vm.previewResult = $sce.trustAsHtml(result);
- })
- .catch(Notify.handleError);
- };
-
- vm.requestSaveAs = function requestSaveAs() {
- const options = {
- url : reportUrl,
- report : reportData,
- reportOptions : angular.copy(vm.reportDetails),
- };
-
- return SavedReports.saveAsModal(options)
- .then(() => {
- $state.go('reportsBase.reportsArchive', { key : options.report.report_key });
- })
- .catch(Notify.handleError);
- };
-
- function checkCachedConfiguration() {
- vm.reportDetails = angular.copy(cache.reportDetails || {});
- }
-}
diff --git a/client/src/modules/reports/generate/stock_changes/stock_changes.html b/client/src/modules/reports/generate/stock_changes/stock_changes.html
deleted file mode 100644
index eeb443cae7..0000000000
--- a/client/src/modules/reports/generate/stock_changes/stock_changes.html
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
REPORT.STOCK_CHANGES.TITLE
-
REPORT.STOCK_CHANGES.DESCRIPTION
-
-
-
-
-
-
-
- REPORT.UTIL.OPTIONS
-
-
-
-
-
-
-
-
-
-
diff --git a/client/src/modules/reports/reports.routes.js b/client/src/modules/reports/reports.routes.js
index 9cd0874c8d..4eef38725a 100644
--- a/client/src/modules/reports/reports.routes.js
+++ b/client/src/modules/reports/reports.routes.js
@@ -45,7 +45,6 @@ angular.module('bhima.routes')
'recovery_capacity',
'rumer_report',
'satisfaction_rate_report',
- 'stock_changes',
'stock_consumption_graph_report',
'stock_entry',
'stock_exit',
diff --git a/server/config/routes.js b/server/config/routes.js
index de5d24bfc5..1f36111a07 100644
--- a/server/config/routes.js
+++ b/server/config/routes.js
@@ -889,7 +889,6 @@ exports.configure = function configure(app) {
app.get('/reports/stock/lost', stockReports.lostStockReport);
app.get('/reports/stock/movement_report', stockReports.movementReport);
app.get('/reports/stock/expiration_report', stockReports.expirationReport);
- app.get('/reports/stock/changes', stockReports.stockChangesReport);
app.get('/reports/stock/lots', stockReports.stockLotsReport);
app.get('/reports/stock/movements', stockReports.stockMovementsReport);
diff --git a/server/controllers/stock/reports/index.js b/server/controllers/stock/reports/index.js
index 273a112801..021f8d3b33 100644
--- a/server/controllers/stock/reports/index.js
+++ b/server/controllers/stock/reports/index.js
@@ -41,7 +41,6 @@ const stockValue = require('./stock/value');
const stockAssignmentReceipt = require('./stock/assignment/stock_assign.receipt');
const stockAssignReport = require('./stock/assignment/stock_assign.registry');
const stockRequisitionReceipt = require('../requisition/requisition.receipt');
-const stockChangesReport = require('./stock/stock_changes/stock_changes');
const lotBarcodeReceipt = require('./stock/lot_barcode/lot_barcode');
/**
@@ -167,7 +166,6 @@ exports.purchasePrices = require('./purchase_prices');
exports.lotBarcodeReceipt = lotBarcodeReceipt;
exports.lostStockReport = lostStockReport;
-exports.stockChangesReport = stockChangesReport;
exports.stockAdjustmentReceipt = stockAdjustmentReceipt;
exports.stockExitAggregateConsumptionReceipt = stockExitAggregateConsumptionReceipt;
diff --git a/server/controllers/stock/reports/stock/stock_changes/stock_changes.js b/server/controllers/stock/reports/stock/stock_changes/stock_changes.js
deleted file mode 100644
index 991f2ab327..0000000000
--- a/server/controllers/stock/reports/stock/stock_changes/stock_changes.js
+++ /dev/null
@@ -1,77 +0,0 @@
-const {
- _, ReportManager, Stock, db,
-} = require('../../common');
-
-const Periods = require('../../../../finance/period');
-
-const DEFAULT_PARAMS = {
- csvKey : 'rows',
- filename : 'REPORT.STOCK_CHANGES.TITLE',
-};
-
-const STOCK_CHANGES_REPORT_TEMPLATE = './server/controllers/stock/reports/stock/stock_changes/stock_changes.handlebars';
-
-/**
- * @function generate
- *
- * @description
- * Generates the stock changes report.
- *
- */
-async function generate(req, res, next) {
-
- try {
- const options = _.extend(req.query, DEFAULT_PARAMS);
-
- const report = new ReportManager(STOCK_CHANGES_REPORT_TEMPLATE, req.session, options);
-
- // get query the period dates and the depot for the name
- const [period, depot] = await Promise.all([
- Periods.lookupPeriodById(options.period_id),
- db.one('SELECT * FROM depot WHERE uuid = ?', db.bid(options.depot_uuid)),
- ]);
-
- // get the stock in the depot as of the end of the period
- const lots = await Stock.getLotsDepot(depot.uuid, {
- dateTo : period.end_date,
- includeEmptyLot : 0,
- month_average_consumption : req.session.stock_settings.month_average_consumption,
- average_consumption_algo : req.session.stock_settings.average_consumption_algo,
- });
-
- const data = {};
-
- const rawData = _.groupBy(lots, 'text');
-
- const objectWithSortedKeys = objectSorter(rawData);
-
- _.keys(objectWithSortedKeys).forEach(item => {
- const value = _.sortBy(objectWithSortedKeys[item], ['label']);
- data[item] = value;
- });
-
- const totals = { lots : lots.length, items : Object.keys(data).length };
-
- const result = await report.render({
- data, depot, period, totals,
- });
-
- res.set(result.headers).send(result.report);
- } catch (e) {
- next(e);
- }
-}
-
-/**
- * This function sorts object keys
- * @param {object} obj
- * @returns {object}
- */
-function objectSorter(obj) {
- return Object.keys(obj).sort(Intl.Collator().compare).reduce((result, key) => {
- result[key] = obj[key];
- return result;
- }, {});
-}
-
-module.exports = generate;
diff --git a/server/models/bhima.sql b/server/models/bhima.sql
index e2f2879649..cb6313f720 100644
--- a/server/models/bhima.sql
+++ b/server/models/bhima.sql
@@ -153,7 +153,6 @@ INSERT INTO unit VALUES
(289, 'Stock Expiration report','TREE.STOCK_EXPIRATION_REPORT','Stock expiration report', 282,'/reports/stock_expiration_report'),
(290, '[SETTINGS] Settings', 'TREE.STOCK_SETTINGS', 'Stock Settings', 160, '/stock/setting'),
(291, 'Stock Dashboard', 'TREE.STOCK_DASHBOARD','Stock Dashboard', 160,'/stock/dashboard'),
- (292, 'Stock Changes Report', 'REPORT.STOCK_CHANGES.TITLE', 'Stock Changes Report', 282, '/reports/stock_changes'),
(293, 'Aggregated consumption','TREE.AGGREGATED_STOCK_CONSUMPTION','Aggregated consumption', 160,'/stock/aggregated_consumption'),
(294, 'Duplicate Lots','TREE.DUPLICATE_LOTS','The stock lots duplicates list', 160,'/stock/lots/duplicates'),
(295, 'Rumer report','TREE.RUMER_REPORT','The rumer reports', 282,'/reports/rumer_report'),
@@ -242,7 +241,6 @@ INSERT IGNORE INTO `report` (`report_key`, `title_key`) VALUES
('recovery_capacity', 'REPORT.RECOVERY_CAPACITY.TITLE'),
('rumer_report', 'REPORT.RUMER.TITLE'),
('satisfaction_rate_report', 'TREE.SATISFACTION_RATE_REPORT'),
- ('stock_changes', 'REPORT.STOCK_CHANGES.TITLE'),
('stock_consumption_graph_report', 'REPORT.STOCK_CONSUMPTION_GRAPH_REPORT.TITLE'),
('stock_entry', 'REPORT.STOCK.ENTRY_REPORT'),
('stock_exit', 'REPORT.STOCK.EXIT_REPORT'),
@@ -584,4 +582,3 @@ VALUES
(15, 'REAM', 1),
(16, 'SACK', 1),
(17, 'SET', 1);
-
diff --git a/server/models/migrations/next/migrate.sql b/server/models/migrations/next/migrate.sql
index a605b6d0ad..0c11b28df7 100644
--- a/server/models/migrations/next/migrate.sql
+++ b/server/models/migrations/next/migrate.sql
@@ -1 +1,5 @@
-/* v1.28.x */
\ No newline at end of file
+/* v1.28.x */
+
+-- remove references to stock_changes report
+DELETE FROM unit WHERE `path` = '/reports/stock_changes';
+DELETE FROM report where `report_key` = 'stock_changes';