refactor: fetch as dictionary

This commit is contained in:
ruthra kumar
2024-09-10 12:58:05 +05:30
parent b05b378ef0
commit 2126b10a92

View File

@@ -60,9 +60,9 @@ def identify_cancelled_vouchers(active_vouchers: list[dict] | list | None = None
dt = qb.DocType(_t) dt = qb.DocType(_t)
non_active_vouchers = ( non_active_vouchers = (
qb.from_(dt) qb.from_(dt)
.select(ConstantColumn(_t).as_("doctype"), dt.name) .select(ConstantColumn(_t).as_("voucher_type"), dt.name.as_("voucher_no"))
.where(dt.docstatus.ne(1) & dt.name.isin(_names)) .where(dt.docstatus.ne(1) & dt.name.isin(_names))
.run() .run(as_dict=True)
) )
if non_active_vouchers: if non_active_vouchers:
cancelled_vouchers.extend(non_active_vouchers) cancelled_vouchers.extend(non_active_vouchers)