mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 23:49:19 +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_frozen_disabled,
|
||||||
validate_party_gle_currency,
|
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
|
from erpnext.exceptions import InvalidAccountCurrency
|
||||||
|
|
||||||
exclude_from_linked_with = True
|
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)
|
ref_doc = frappe.get_doc(against_voucher_type, against_voucher)
|
||||||
|
|
||||||
# Didn't use db_set for optimization purpose
|
# 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_balance_type,
|
||||||
validate_frozen_account,
|
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
|
from erpnext.exceptions import InvalidAccountDimensionError, MandatoryAccountDimensionError
|
||||||
|
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ class PaymentLedgerEntry(Document):
|
|||||||
|
|
||||||
# update outstanding amount
|
# update outstanding amount
|
||||||
if (
|
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 self.flags.update_outstanding == "Yes"
|
||||||
and not frappe.flags.is_reverse_depr_entry
|
and not frappe.flags.is_reverse_depr_entry
|
||||||
):
|
):
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class PaymentEntryUnlinkError(frappe.ValidationError):
|
|||||||
|
|
||||||
|
|
||||||
GL_REPOSTING_CHUNK = 100
|
GL_REPOSTING_CHUNK = 100
|
||||||
|
OUTSTANDING_DOCTYPES = frozenset(["Sales Invoice", "Purchase Invoice", "Fees"])
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@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
|
# on cancellation outstanding can be an empty list
|
||||||
voucher_outstanding = ple_query.get_voucher_outstandings(vouchers, common_filter=common_filter)
|
voucher_outstanding = ple_query.get_voucher_outstandings(vouchers, common_filter=common_filter)
|
||||||
if (
|
if voucher_type in OUTSTANDING_DOCTYPES and party_type and party and voucher_outstanding:
|
||||||
voucher_type in ["Sales Invoice", "Purchase Invoice", "Fees"]
|
|
||||||
and party_type
|
|
||||||
and party
|
|
||||||
and voucher_outstanding
|
|
||||||
):
|
|
||||||
outstanding = voucher_outstanding[0]
|
outstanding = voucher_outstanding[0]
|
||||||
ref_doc = frappe.get_lazy_doc(voucher_type, voucher_no)
|
ref_doc = frappe.get_lazy_doc(voucher_type, voucher_no)
|
||||||
outstanding_amount = flt(
|
outstanding_amount = flt(
|
||||||
|
|||||||
Reference in New Issue
Block a user