From d44c5b3e02ba5d5c1abcb4908e9cb30ca66d7b27 Mon Sep 17 00:00:00 2001 From: Amritanshu Date: Mon, 11 Jul 2022 20:13:05 +0530 Subject: [PATCH] Fix: Download closing stock report was borked as product was an object not a string. --- overlord/src/app/closing-stock/closing-stock.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/overlord/src/app/closing-stock/closing-stock.component.ts b/overlord/src/app/closing-stock/closing-stock.component.ts index cefc177b..12cc5e98 100644 --- a/overlord/src/app/closing-stock/closing-stock.component.ts +++ b/overlord/src/app/closing-stock/closing-stock.component.ts @@ -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');