From 8300f5ede7abcd6c784ac6b9fbbff4a870eca866 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Tue, 1 Jan 2019 20:28:49 +0530 Subject: [PATCH] fix: Codacy issues and added test case --- .../doctype/loyalty_program/test_loyalty_program.py | 8 ++++++++ erpnext/public/js/utils.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py index bf7a0bcfa4..8a1d6a27be 100644 --- a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py +++ b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py @@ -7,6 +7,7 @@ import frappe import unittest from frappe.utils import today, cint, flt, getdate from erpnext.accounts.doctype.loyalty_program.loyalty_program import get_loyalty_program_details_with_points +from erpnext.accounts.party import get_dashboard_info class TestLoyaltyProgram(unittest.TestCase): @classmethod @@ -144,6 +145,13 @@ class TestLoyaltyProgram(unittest.TestCase): frappe.get_doc('Sales Invoice', d.name).cancel() frappe.delete_doc('Sales Invoice', d.name) + def test_loyalty_points_for_dashboard(self): + doc = frappe.get_doc('Customer', 'Test Loyalty Customer') + company_wise_info = get_dashboard_info("Customer", doc.name, doc.loyalty_program) + + for d in company_wise_info: + self.assertTrue(d.loyalty_points) + def get_points_earned(self): def get_returned_amount(): returned_amount = frappe.db.sql(""" diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 902f83ff07..64085a83cd 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -113,7 +113,7 @@ $.extend(erpnext.utils, { [format_currency(company_wise_info[0].billing_this_year, company_wise_info[0].currency)]), 'blue'); frm.dashboard.add_indicator(__('Total Unpaid: {0}', [format_currency(company_wise_info[0].total_unpaid, company_wise_info[0].currency)]), - company_wise_info[0].total_unpaid ? 'orange' : 'green'); + company_wise_info[0].total_unpaid ? 'orange' : 'green'); if(company_wise_info[0].loyalty_points) { frm.dashboard.add_indicator(__('Loyalty Points: {0}',