Merge pull request #16277 from deepeshgarg007/loyalty-program-fix

fix: Loyalty program issue fix in customer dashboard
This commit is contained in:
Nabin Hait
2019-01-08 12:15:57 +05:30
committed by GitHub
5 changed files with 69 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