fix: Codacy issues and added test case
This commit is contained in:
parent
78ad6c4cb7
commit
8300f5ede7
@ -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("""
|
||||
|
@ -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}',
|
||||
|
Loading…
x
Reference in New Issue
Block a user