From bf09471e9e952580ae94c0c4b7836f5bc4b88c6f Mon Sep 17 00:00:00 2001 From: tanshu Date: Thu, 24 Sep 2020 09:18:58 +0530 Subject: [PATCH] Fix: Discount button was greyed out due to wrong check. Show was sending customer as empty dictionary which triggered an error in input as id was a required column --- barker/routers/voucher/show.py | 2 +- bookie/src/app/sales/home/sales-home.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/barker/routers/voucher/show.py b/barker/routers/voucher/show.py index e33d5f4..60325b6 100644 --- a/barker/routers/voucher/show.py +++ b/barker/routers/voucher/show.py @@ -84,7 +84,7 @@ def voucher_info(item: Voucher): "lastEditDateTip": item.last_edit_date.strftime("%d-%b-%Y %H:%M:%S"), "billId": item.full_bill_id, "table": {"id": item.food_table_id, "name": item.food_table.name}, - "customer": {"id": item.customer_id, "name": item.customer.name} if item.customer is not None else {}, + "customer": {"id": item.customer_id, "name": item.customer.name} if item.customer is not None else None, "settlements": [], "narration": item.narration, "reason": item.reason, diff --git a/bookie/src/app/sales/home/sales-home.component.ts b/bookie/src/app/sales/home/sales-home.component.ts index a23663c..c6523f4 100644 --- a/bookie/src/app/sales/home/sales-home.component.ts +++ b/bookie/src/app/sales/home/sales-home.component.ts @@ -69,7 +69,7 @@ export class SalesHomeComponent implements OnInit { } discountAllowed(): boolean { - return this.auth.user.perms.indexOf('discount') === -1; + return this.auth.user.perms.indexOf('discount') !== -1; } showDiscount(): Observable {