Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credit Limit Check on Journal Entry and Sales Invoice #41426

Open
pro-nature opened this issue May 13, 2024 · 0 comments
Open

Credit Limit Check on Journal Entry and Sales Invoice #41426

pro-nature opened this issue May 13, 2024 · 0 comments

Comments

@pro-nature
Copy link

Information about bug

ERPNext: v15.22.1 (version-15)

Frappe Framework: v15.25.0 (version-15)

For Journal Entry - Credit limit check does not account for bypass sales order amount flag.

`def check_credit_limit(self):
customers = list(
set(
d.party
for d in self.get("accounts")
if d.party_type == "Customer" and d.party and flt(d.debit) > 0
)
)
if customers:
from erpnext.selling.doctype.customer.customer import check_credit_limit

		for customer in customers:
			check_credit_limit(customer, self.company)`

For Sales Invoice, It has a flag check for bypass sales order level check
`def check_credit_limit(self):
from erpnext.selling.doctype.customer.customer import check_credit_limit

	validate_against_credit_limit = False
	bypass_credit_limit_check_at_sales_order = frappe.db.get_value(
		"Customer Credit Limit",
		filters={"parent": self.customer, "parenttype": "Customer", "company": self.company},
		fieldname=["bypass_credit_limit_check"],
	)

	if bypass_credit_limit_check_at_sales_order:
		validate_against_credit_limit = True

	for d in self.get("items"):
		if not (d.sales_order or d.delivery_note):
			validate_against_credit_limit = True
			break
	if validate_against_credit_limit:
		check_credit_limit(self.customer, self.company, bypass_credit_limit_check_at_sales_order)

`
JV check should be similar to Sales Invoice level credit limit check.
Same thing happens while changing the Credit Limit for a customer.

Module

accounts

Version

ERPNext: v15.22.1 (version-15)

Frappe Framework: v15.25.0 (version-15)

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants