diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py index c68cd2925239..f5619f8088fc 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py @@ -353,9 +353,10 @@ def get_balances_based_on_dimensions( if get_opening_entries: query = query.where( - gl_entry.posting_date.between(self.get("year_start_date"), self.posting_date) - | gl_entry.is_opening - == "Yes" + ( # noqa: UP034 + (gl_entry.posting_date.between(self.get("year_start_date"), self.posting_date)) + | (gl_entry.is_opening == "Yes") + ) ) else: query = query.where(