Test case fix and other minor bug fix

This commit is contained in:
deepeshgarg007 2018-11-15 16:24:34 +05:30 committed by Nabin Hait
parent 64b4d98778
commit 9cdece4ca2
4 changed files with 47 additions and 29 deletions

View File

@ -568,10 +568,10 @@ erpnext.patches.v11_0.remove_land_unit_icon
erpnext.patches.v11_0.add_default_dispatch_notification_template
erpnext.patches.v11_0.add_market_segments
erpnext.patches.v11_0.add_sales_stages
execute:frappe.delete_doc("Page", "Sales Analytics")
execute:frappe.delete_doc("Page", "Purchase Analytics")
execute:frappe.delete_doc("Page", "Stock Analytics")
execute:frappe.delete_doc("Page", "Production Analytics")
execute:frappe.delete_doc("Page", "sales-analytics")
execute:frappe.delete_doc("Page", "purchase-analytics")
execute:frappe.delete_doc("Page", "stock-analytics")
execute:frappe.delete_doc("Page", "production-analytics")
erpnext.patches.v11_0.ewaybill_fields_gst_india #2018-11-13
erpnext.patches.v11_0.drop_column_max_days_allowed
erpnext.patches.v11_0.change_healthcare_desktop_icons

View File

@ -67,23 +67,16 @@ frappe.query_reports["Sales Analytics"] = {
reqd: 1
}
],
"formatter": function(value, row, column, data) {
if(!value){
value = 0
}
return value;
},
get_datatable_options(options) {
return Object.assign(options, {
checkboxColumn: true,
events: {
onCheckRow: function(data) {
row_name = data[2].content;
row_values = data.slice(5).map(function (column) {
row_values = data.slice(4).map(function (column) {
return column.content;
})
entry = {
entry = {
'name':row_name,
'values':row_values
}

View File

@ -275,7 +275,7 @@ class Analytics(object):
self.parent_child_map = frappe._dict(frappe.db.sql(""" select name, supplier_group from `tabSupplier`"""))
def get_chart_data(self):
labels = [d.get("label") for d in self.columns[3:]]
labels = [d.get("label") for d in self.columns[2:]]
self.chart = {
"data": {
'labels': labels,

View File

@ -9,9 +9,6 @@ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_orde
class TestAnalytics(unittest.TestCase):
def tearDown(self):
frappe.db.sql(""" DELETE FROM `tabSales Order` """)
def test_by_entity(self):
create_sales_order()
@ -20,7 +17,7 @@ class TestAnalytics(unittest.TestCase):
'range': 'Monthly',
'to_date': '2018-03-31',
'tree_type': 'Customer',
'company': '_Test Company',
'company': '_Test Company 2',
'from_date': '2017-04-01',
'value_quantity': 'Value'
}
@ -83,14 +80,13 @@ class TestAnalytics(unittest.TestCase):
self.assertEqual(expected_data, report[1])
def test_by_group(self):
create_sales_order()
filters = {
'doc_type': 'Sales Order',
'range': 'Monthly',
'to_date': '2018-03-31',
'tree_type': 'Customer Group',
'company': '_Test Company',
'company': '_Test Company 2',
'from_date': '2017-04-01',
'value_quantity': 'Value'
}
@ -170,14 +166,13 @@ class TestAnalytics(unittest.TestCase):
self.assertEqual(expected_data, report[1])
def test_by_quantity(self):
create_sales_order()
filters = {
'doc_type': 'Sales Order',
'range': 'Monthly',
'to_date': '2018-03-31',
'tree_type': 'Customer',
'company': '_Test Company',
'company': '_Test Company 2',
'from_date': '2017-04-01',
'value_quantity': 'Quantity'
}
@ -242,9 +237,39 @@ class TestAnalytics(unittest.TestCase):
def create_sales_order():
frappe.set_user("Administrator")
make_sales_order(qty=10, customer = "_Test Customer 1", transaction_date='2018-02-10')
make_sales_order(qty=10, customer = "_Test Customer 1", transaction_date='2018-02-15')
make_sales_order(qty=15, customer = "_Test Customer 2", transaction_date='2017-09-23')
make_sales_order(qty=10, customer = "_Test Customer 2", transaction_date='2017-10-10')
make_sales_order(qty=20, customer = "_Test Customer 3", transaction_date='2017-06-15')
make_sales_order(qty=10, customer = "_Test Customer 3", transaction_date='2017-07-10')
make_sales_order(company="_Test Company 2", qty=10,
customer = "_Test Customer 1",
transaction_date = '2018-02-10',
warehouse = 'Finished Goods - _TC2',
currency = 'EUR')
make_sales_order(company="_Test Company 2",
qty=10, customer = "_Test Customer 1",
transaction_date = '2018-02-15',
warehouse = 'Finished Goods - _TC2',
currency = 'EUR')
make_sales_order(company = "_Test Company 2",
qty=10, customer = "_Test Customer 2",
transaction_date = '2017-10-10',
warehouse='Finished Goods - _TC2',
currency = 'EUR')
make_sales_order(company="_Test Company 2",
qty=15, customer = "_Test Customer 2",
transaction_date='2017-09-23',
warehouse='Finished Goods - _TC2',
currency = 'EUR')
make_sales_order(company="_Test Company 2",
qty=20, customer = "_Test Customer 3",
transaction_date='2017-06-15',
warehouse='Finished Goods - _TC2',
currency = 'EUR')
make_sales_order(company="_Test Company 2",
qty=10, customer = "_Test Customer 3",
transaction_date='2017-07-10',
warehouse='Finished Goods - _TC2',
currency = 'EUR')