Always ensure that a "KOT" Bill Number was generated even if the bill was straight printed.
This commit is contained in:
parent
4db26722a3
commit
47afb7e29c
@ -14,6 +14,7 @@ from sqlalchemy.sql import expression
|
||||
|
||||
from ...models.guest_book import GuestBook
|
||||
from ...models.overview import Overview
|
||||
from ...models.regime import Regime
|
||||
from ...models.settle_option import SettleOption
|
||||
from ...models.settlement import Settlement
|
||||
from ...models.voucher import Voucher
|
||||
@ -136,7 +137,8 @@ def do_update_bill_numbers(voucher: Voucher, db: Session) -> bool:
|
||||
.where(Bill.voucher_id == voucher.id, Bill.regime_id.in_(old_regimes - regimes))
|
||||
.values(is_valid=False)
|
||||
)
|
||||
|
||||
if Regime.KOT() not in old_regimes | regimes:
|
||||
regimes.add(Regime.KOT())
|
||||
for r in regimes - old_regimes:
|
||||
bill_id = db.execute(
|
||||
expression.select(func.coalesce(func.max(Bill.bill_number), 0) + 1).where(Bill.regime_id == r)
|
||||
|
Loading…
Reference in New Issue
Block a user