mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-11 19:05:08 +00:00
fix: prevent selection of group type customer group in customer master
(cherry picked from commit 6068dc959f)
This commit is contained in:
@@ -173,6 +173,7 @@ class Customer(TransactionBase):
|
|||||||
def validate(self):
|
def validate(self):
|
||||||
self.flags.is_new_doc = self.is_new()
|
self.flags.is_new_doc = self.is_new()
|
||||||
self.flags.old_lead = self.lead_name
|
self.flags.old_lead = self.lead_name
|
||||||
|
self.validate_customer_group()
|
||||||
validate_party_accounts(self)
|
validate_party_accounts(self)
|
||||||
self.validate_credit_limit_on_change()
|
self.validate_credit_limit_on_change()
|
||||||
self.set_loyalty_program()
|
self.set_loyalty_program()
|
||||||
@@ -356,6 +357,17 @@ class Customer(TransactionBase):
|
|||||||
frappe.NameError,
|
frappe.NameError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def validate_customer_group(self):
|
||||||
|
if not self.customer_group:
|
||||||
|
return
|
||||||
|
|
||||||
|
is_group = frappe.db.get_value("Customer Group", self.customer_group, "is_group")
|
||||||
|
if is_group:
|
||||||
|
frappe.throw(
|
||||||
|
_("Cannot select a Group type Customer Group. Please select a non-group Customer Group."),
|
||||||
|
title=_("Invalid Customer Group"),
|
||||||
|
)
|
||||||
|
|
||||||
def validate_credit_limit_on_change(self):
|
def validate_credit_limit_on_change(self):
|
||||||
if self.get("__islocal") or not self.credit_limits:
|
if self.get("__islocal") or not self.credit_limits:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user