fix: Replace ORM with query builder

This commit is contained in:
Deepesh Garg 2022-02-06 22:56:12 +05:30
parent ffec865e00
commit ff57450e77

View File

@ -319,13 +319,18 @@ def make_reverse_gl_entries(gl_entries=None, voucher_type=None, voucher_no=None,
""" """
if not gl_entries: if not gl_entries:
gl_entries = frappe.get_all("GL Entry", gl_entry = frappe.qb.DocType("GL Entry")
fields = ["*"], gl_entries = (frappe.qb.from_(
filters = { gl_entry
"voucher_type": voucher_type, ).select(
"voucher_no": voucher_no, '*'
"is_cancelled": 0 ).where(
}, for_update=True) gl_entry.voucher_type == voucher_type
).where(
gl_entry.voucher_no == voucher_no
).where(
gl_entry.is_cancelled == 0
).for_update()).run(as_dict=1)
if gl_entries: if gl_entries:
validate_accounting_period(gl_entries) validate_accounting_period(gl_entries)