Fix: Download closing stock report was borked as product was an object not a string.

This commit is contained in:
Amritanshu Agrawal 2022-07-11 20:13:05 +05:30
parent b1c003a935
commit d44c5b3e02

View File

@ -137,7 +137,10 @@ export class ClosingStockComponent implements OnInit {
Amount: 'amount',
};
const csvData = new Blob([this.toCsv.toCsv(headers, this.dataSource.data)], {
const d = JSON.parse(JSON.stringify(this.dataSource.data)).map(
(x: ClosingStockItem)=> ({product: x.product.name, group: x.group, quantity: x.quantity, amount: x.amount})
);
const csvData = new Blob([this.toCsv.toCsv(headers, d)], {
type: 'text/csv;charset=utf-8;',
});
const link = document.createElement('a');