Fix: Reprint was not physically printing the bill.
This commit is contained in:
parent
7ff546a442
commit
095f4fe473
@ -15,6 +15,7 @@ from ...models.reprint import Reprint
|
|||||||
from ...models.settle_option import SettleOption
|
from ...models.settle_option import SettleOption
|
||||||
from ...models.voucher import Voucher
|
from ...models.voucher import Voucher
|
||||||
from ...models.voucher_type import VoucherType
|
from ...models.voucher_type import VoucherType
|
||||||
|
from ...printing.bill import print_bill
|
||||||
from ...routers.voucher import do_update_settlements, get_guest_book
|
from ...routers.voucher import do_update_settlements, get_guest_book
|
||||||
from ...schemas.receive_payment import ReceivePaymentItem as SettleSchema
|
from ...schemas.receive_payment import ReceivePaymentItem as SettleSchema
|
||||||
from ...schemas.user_token import UserToken
|
from ...schemas.user_token import UserToken
|
||||||
@ -57,10 +58,11 @@ def change(
|
|||||||
!= 0
|
!= 0
|
||||||
)
|
)
|
||||||
if bill_changed:
|
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:
|
else:
|
||||||
reprint_bill(id_, user.id_, db)
|
reprint_bill(id_, user.id_, db)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
print_bill(id_, db)
|
||||||
except SQLAlchemyError as e:
|
except SQLAlchemyError as e:
|
||||||
db.rollback()
|
db.rollback()
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
@ -84,7 +86,7 @@ def void_and_issue_new_bill(
|
|||||||
old: Voucher,
|
old: Voucher,
|
||||||
db: Session,
|
db: Session,
|
||||||
user: UserToken,
|
user: UserToken,
|
||||||
):
|
) -> uuid.UUID:
|
||||||
update_table = u
|
update_table = u
|
||||||
guest_book = get_guest_book(g, db)
|
guest_book = get_guest_book(g, db)
|
||||||
item: Voucher = do_save(data, old.voucher_type, guest_book, db, user)
|
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)
|
db.add(item.status)
|
||||||
else:
|
else:
|
||||||
db.query(Overview).filter(Overview.voucher_id == old.id).update({Overview.voucher_id: item.id})
|
db.query(Overview).filter(Overview.voucher_id == old.id).update({Overview.voucher_id: item.id})
|
||||||
|
return item.id
|
||||||
|
Loading…
Reference in New Issue
Block a user