feat: bypass credit limit check
This commit is contained in:
parent
36b30911a8
commit
79525327f0
@ -304,8 +304,10 @@ class SalesInvoice(SellingController):
|
|||||||
from erpnext.selling.doctype.customer.customer import check_credit_limit
|
from erpnext.selling.doctype.customer.customer import check_credit_limit
|
||||||
|
|
||||||
validate_against_credit_limit = False
|
validate_against_credit_limit = False
|
||||||
bypass_credit_limit_check_at_sales_order = cint(frappe.get_cached_value("Customer", self.customer,
|
bypass_credit_limit_check_at_sales_order = frappe.db.get_value("Customer Credit Limit",
|
||||||
"bypass_credit_limit_check_at_sales_order"))
|
filters={'parent': self.customer, 'company': self.company},
|
||||||
|
fieldname=["bypass_credit_limit_check"])
|
||||||
|
|
||||||
if bypass_credit_limit_check_at_sales_order:
|
if bypass_credit_limit_check_at_sales_order:
|
||||||
validate_against_credit_limit = True
|
validate_against_credit_limit = True
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ class SalesOrder(SellingController):
|
|||||||
def check_credit_limit(self):
|
def check_credit_limit(self):
|
||||||
# if bypass credit limit check is set to true (1) at sales order level,
|
# if bypass credit limit check is set to true (1) at sales order level,
|
||||||
# then we need not to check credit limit and vise versa
|
# then we need not to check credit limit and vise versa
|
||||||
if not cint(frappe.get_cached_value("Customer", self.customer, "bypass_credit_limit_check_at_sales_order")):
|
if not cint(frappe.db.get_value("Customer Credit Limit", {'parent': self.customer, 'company': self.company}, "bypass_credit_limit_check")):
|
||||||
check_credit_limit(self.customer, self.company)
|
check_credit_limit(self.customer, self.company)
|
||||||
|
|
||||||
def check_nextdoc_docstatus(self):
|
def check_nextdoc_docstatus(self):
|
||||||
|
@ -234,8 +234,10 @@ class DeliveryNote(SellingController):
|
|||||||
|
|
||||||
extra_amount = 0
|
extra_amount = 0
|
||||||
validate_against_credit_limit = False
|
validate_against_credit_limit = False
|
||||||
bypass_credit_limit_check_at_sales_order = cint(frappe.db.get_value("Customer", self.customer,
|
bypass_credit_limit_check_at_sales_order = cint(frappe.db.get_value("Customer Credit Limit",
|
||||||
"bypass_credit_limit_check_at_sales_order"))
|
filters={'parent': self.customer, 'company': self.company},
|
||||||
|
fieldname="bypass_credit_limit_check"))
|
||||||
|
|
||||||
if bypass_credit_limit_check_at_sales_order:
|
if bypass_credit_limit_check_at_sales_order:
|
||||||
validate_against_credit_limit = True
|
validate_against_credit_limit = True
|
||||||
extra_amount = self.base_grand_total
|
extra_amount = self.base_grand_total
|
||||||
|
Loading…
x
Reference in New Issue
Block a user