diff --git a/barker/barker/routers/voucher/change.py b/barker/barker/routers/voucher/change.py index b8dd668..c400f31 100644 --- a/barker/barker/routers/voucher/change.py +++ b/barker/barker/routers/voucher/change.py @@ -17,6 +17,7 @@ from ...models.settle_option import SettleOption from ...models.voucher import Voucher from ...models.voucher_type import VoucherType from ...printing.bill import print_bill +from ...printing.kot import print_kot from ...routers.voucher import do_update_settlements, get_guest_book from ...schemas.receive_payment import ReceivePaymentItem as SettleSchema from ...schemas.user_token import UserToken @@ -49,11 +50,15 @@ def change( ) != 0 ) + new_kot: bool = len([k for k in data.kots if k.id_ is None and len(k.inventories) > 0]) > 0 if bill_changed: id_ = void_and_issue_new_bill(data, u, g, old, db, user) else: reprint_bill(id_, user.id_, db) db.commit() + with SessionFuture() as db: + if bill_changed and new_kot: + print_kot(id_, db) print_bill(id_, db) except SQLAlchemyError as e: raise HTTPException(