mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-18 02:55:20 +00:00
Merge pull request #16277 from deepeshgarg007/loyalty-program-fix
fix: Loyalty program issue fix in customer dashboard
This commit is contained in:
@@ -113,11 +113,6 @@ frappe.ui.form.on("Customer", {
|
||||
// indicator
|
||||
erpnext.utils.set_party_dashboard_indicators(frm);
|
||||
|
||||
//
|
||||
if (frm.doc.__onload.dashboard_info.loyalty_point) {
|
||||
frm.dashboard.add_indicator(__('Loyalty Point: {0}', [frm.doc.__onload.dashboard_info.loyalty_point]), 'blue');
|
||||
}
|
||||
|
||||
} else {
|
||||
frappe.contacts.clear_address_and_contact(frm);
|
||||
}
|
||||
|
||||
@@ -23,10 +23,7 @@ class Customer(TransactionBase):
|
||||
self.load_dashboard_info()
|
||||
|
||||
def load_dashboard_info(self):
|
||||
info = get_dashboard_info(self.doctype, self.name)
|
||||
loyalty_point_details = self.get_loyalty_points()
|
||||
if loyalty_point_details and loyalty_point_details.get("loyalty_points"):
|
||||
info["loyalty_point"] = loyalty_point_details.loyalty_points
|
||||
info = get_dashboard_info(self.doctype, self.name, self.loyalty_program)
|
||||
self.set_onload('dashboard_info', info)
|
||||
|
||||
def autoname(self):
|
||||
@@ -36,11 +33,6 @@ class Customer(TransactionBase):
|
||||
else:
|
||||
set_name_by_naming_series(self)
|
||||
|
||||
def get_loyalty_points(self):
|
||||
if self.loyalty_program:
|
||||
from erpnext.accounts.doctype.loyalty_program.loyalty_program import get_loyalty_details
|
||||
return get_loyalty_details(self.name, self.loyalty_program)
|
||||
|
||||
def get_customer_name(self):
|
||||
if frappe.db.get_value("Customer", self.customer_name):
|
||||
count = frappe.db.sql("""select ifnull(MAX(CAST(SUBSTRING_INDEX(name, ' ', -1) AS UNSIGNED)), 0) from tabCustomer
|
||||
|
||||
Reference in New Issue
Block a user