Loyalty program issue fix in customer dashboard

This commit is contained in:
deepeshgarg007
2018-12-25 16:06:19 +05:30
parent 5a9579bae4
commit 12f5cefc12
4 changed files with 59 additions and 36 deletions

View File

@@ -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);
}

View File

@@ -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