Sales Goal by Company (#9723)
* [sales goal] in company; dashboard, graph, notifs, wiz * [test] target notifications * cache past year monthly sales of every company daily, patch * [minor] query fixes * update sales goal docs
This commit is contained in:
committed by
Makarand Bauskar
parent
e2d0d0a0c1
commit
e012e24423
46
erpnext/tests/test_notifications.py
Normal file
46
erpnext/tests/test_notifications.py
Normal file
@@ -0,0 +1,46 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# MIT License. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
|
||||
from frappe.desk import notifications
|
||||
from frappe.test_runner import make_test_objects
|
||||
|
||||
class TestNotifications(unittest.TestCase):
|
||||
def setUp(self):
|
||||
test_records = [
|
||||
{
|
||||
"abbr": "_TC6",
|
||||
"company_name": "_Test Company 6",
|
||||
"country": "India",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"sales_target": 2000,
|
||||
"chart_of_accounts": "Standard"
|
||||
},
|
||||
{
|
||||
"abbr": "_TC7",
|
||||
"company_name": "_Test Company 7",
|
||||
"country": "United States",
|
||||
"default_currency": "USD",
|
||||
"doctype": "Company",
|
||||
"domain": "Retail",
|
||||
"sales_target": 10000,
|
||||
"total_monthly_sales": 1000,
|
||||
"chart_of_accounts": "Standard"
|
||||
},
|
||||
]
|
||||
|
||||
make_test_objects('Company', test_records=test_records, reset=True)
|
||||
|
||||
def test_get_notifications_for_targets(self):
|
||||
'''
|
||||
Test notification config entries for targets as percentages
|
||||
'''
|
||||
|
||||
config = notifications.get_notification_config()
|
||||
doc_target_percents = notifications.get_notifications_for_targets(config, {})
|
||||
self.assertEquals(doc_target_percents['Company']['_Test Company 7'], 10)
|
||||
self.assertEquals(doc_target_percents['Company']['_Test Company 6'], 0)
|
||||
Reference in New Issue
Block a user