Fix: Reprint was not physically printing the bill.

This commit is contained in:
Amritanshu Agrawal 2021-03-26 07:19:57 +05:30
parent 7ff546a442
commit 095f4fe473
1 changed files with 5 additions and 2 deletions

View File

@ -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