Fix: Editing printed bill will also print the new kot (if any)
This commit is contained in:
parent
e144175fe0
commit
74e67a98e6
@ -17,6 +17,7 @@ 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 ...printing.bill import print_bill
|
||||||
|
from ...printing.kot import print_kot
|
||||||
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
|
||||||
@ -49,11 +50,15 @@ def change(
|
|||||||
)
|
)
|
||||||
!= 0
|
!= 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:
|
if bill_changed:
|
||||||
id_ = 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()
|
||||||
|
with SessionFuture() as db:
|
||||||
|
if bill_changed and new_kot:
|
||||||
|
print_kot(id_, db)
|
||||||
print_bill(id_, db)
|
print_bill(id_, db)
|
||||||
except SQLAlchemyError as e:
|
except SQLAlchemyError as e:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
|
Loading…
Reference in New Issue
Block a user