Fix: Show voucher without kots and iventories would cause an error in show.
This commit is contained in:
@ -212,8 +212,19 @@ def from_table(
|
||||
)
|
||||
)
|
||||
.unique()
|
||||
.scalar_one()
|
||||
.scalar_one_or_none()
|
||||
)
|
||||
if item is None:
|
||||
item = db.execute(
|
||||
select(Voucher)
|
||||
.join(Voucher.food_table)
|
||||
.join(Voucher.customer, isouter=True)
|
||||
.where(Voucher.id == v)
|
||||
.options(
|
||||
contains_eager(Voucher.food_table),
|
||||
contains_eager(Voucher.customer),
|
||||
)
|
||||
).scalar_one()
|
||||
|
||||
if guest is not None:
|
||||
item.customer = guest.customer
|
||||
|
||||
Reference in New Issue
Block a user