From 095f4fe473a82a92232eb75fa79f0a2df2c8a7c3 Mon Sep 17 00:00:00 2001 From: tanshu Date: Fri, 26 Mar 2021 07:19:57 +0530 Subject: [PATCH] Fix: Reprint was not physically printing the bill. --- barker/barker/routers/voucher/change.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/barker/barker/routers/voucher/change.py b/barker/barker/routers/voucher/change.py index def8392..b80850e 100644 --- a/barker/barker/routers/voucher/change.py +++ b/barker/barker/routers/voucher/change.py @@ -15,6 +15,7 @@ from ...models.reprint import Reprint from ...models.settle_option import SettleOption from ...models.voucher import Voucher from ...models.voucher_type import VoucherType +from ...printing.bill import print_bill from ...routers.voucher import do_update_settlements, get_guest_book from ...schemas.receive_payment import ReceivePaymentItem as SettleSchema from ...schemas.user_token import UserToken @@ -57,10 +58,11 @@ def change( != 0 ) if bill_changed: - void_and_issue_new_bill(data, u, g, old, db, user) + id_ = void_and_issue_new_bill(data, u, g, old, db, user) else: reprint_bill(id_, user.id_, db) db.commit() + print_bill(id_, db) except SQLAlchemyError as e: db.rollback() raise HTTPException( @@ -84,7 +86,7 @@ def void_and_issue_new_bill( old: Voucher, db: Session, user: UserToken, -): +) -> uuid.UUID: update_table = u guest_book = get_guest_book(g, db) item: Voucher = do_save(data, old.voucher_type, guest_book, db, user) @@ -100,3 +102,4 @@ def void_and_issue_new_bill( db.add(item.status) else: db.query(Overview).filter(Overview.voucher_id == old.id).update({Overview.voucher_id: item.id}) + return item.id