mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-18 09:05:00 +00:00
fix: do not query outstanding for Journal Entry
This commit is contained in:
@@ -18,7 +18,7 @@ from erpnext.accounts.party import (
|
||||
validate_party_frozen_disabled,
|
||||
validate_party_gle_currency,
|
||||
)
|
||||
from erpnext.accounts.utils import get_account_currency, get_fiscal_year
|
||||
from erpnext.accounts.utils import OUTSTANDING_DOCTYPES, get_account_currency, get_fiscal_year
|
||||
from erpnext.exceptions import InvalidAccountCurrency
|
||||
|
||||
exclude_from_linked_with = True
|
||||
@@ -382,7 +382,7 @@ def update_outstanding_amt(
|
||||
)
|
||||
)
|
||||
|
||||
if against_voucher_type in ["Sales Invoice", "Purchase Invoice", "Fees"]:
|
||||
if against_voucher_type in OUTSTANDING_DOCTYPES:
|
||||
ref_doc = frappe.get_doc(against_voucher_type, against_voucher)
|
||||
|
||||
# Didn't use db_set for optimization purpose
|
||||
|
||||
@@ -16,7 +16,7 @@ from erpnext.accounts.doctype.gl_entry.gl_entry import (
|
||||
validate_balance_type,
|
||||
validate_frozen_account,
|
||||
)
|
||||
from erpnext.accounts.utils import update_voucher_outstanding
|
||||
from erpnext.accounts.utils import OUTSTANDING_DOCTYPES, update_voucher_outstanding
|
||||
from erpnext.exceptions import InvalidAccountDimensionError, MandatoryAccountDimensionError
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ class PaymentLedgerEntry(Document):
|
||||
|
||||
# update outstanding amount
|
||||
if (
|
||||
self.against_voucher_type in ["Journal Entry", "Sales Invoice", "Purchase Invoice", "Fees"]
|
||||
self.against_voucher_type in OUTSTANDING_DOCTYPES
|
||||
and self.flags.update_outstanding == "Yes"
|
||||
and not frappe.flags.is_reverse_depr_entry
|
||||
):
|
||||
|
||||
@@ -49,6 +49,7 @@ class PaymentEntryUnlinkError(frappe.ValidationError):
|
||||
|
||||
|
||||
GL_REPOSTING_CHUNK = 100
|
||||
OUTSTANDING_DOCTYPES = frozenset(["Sales Invoice", "Purchase Invoice", "Fees"])
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
@@ -1884,12 +1885,7 @@ def update_voucher_outstanding(voucher_type, voucher_no, account, party_type, pa
|
||||
|
||||
# on cancellation outstanding can be an empty list
|
||||
voucher_outstanding = ple_query.get_voucher_outstandings(vouchers, common_filter=common_filter)
|
||||
if (
|
||||
voucher_type in ["Sales Invoice", "Purchase Invoice", "Fees"]
|
||||
and party_type
|
||||
and party
|
||||
and voucher_outstanding
|
||||
):
|
||||
if voucher_type in OUTSTANDING_DOCTYPES and party_type and party and voucher_outstanding:
|
||||
outstanding = voucher_outstanding[0]
|
||||
ref_doc = frappe.get_lazy_doc(voucher_type, voucher_no)
|
||||
outstanding_amount = flt(
|
||||
|
||||
Reference in New Issue
Block a user