Test case fix and other minor bug fix
This commit is contained in:
parent
64b4d98778
commit
9cdece4ca2
@ -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_default_dispatch_notification_template
|
||||||
erpnext.patches.v11_0.add_market_segments
|
erpnext.patches.v11_0.add_market_segments
|
||||||
erpnext.patches.v11_0.add_sales_stages
|
erpnext.patches.v11_0.add_sales_stages
|
||||||
execute:frappe.delete_doc("Page", "Sales Analytics")
|
execute:frappe.delete_doc("Page", "sales-analytics")
|
||||||
execute:frappe.delete_doc("Page", "Purchase Analytics")
|
execute:frappe.delete_doc("Page", "purchase-analytics")
|
||||||
execute:frappe.delete_doc("Page", "Stock Analytics")
|
execute:frappe.delete_doc("Page", "stock-analytics")
|
||||||
execute:frappe.delete_doc("Page", "Production Analytics")
|
execute:frappe.delete_doc("Page", "production-analytics")
|
||||||
erpnext.patches.v11_0.ewaybill_fields_gst_india #2018-11-13
|
erpnext.patches.v11_0.ewaybill_fields_gst_india #2018-11-13
|
||||||
erpnext.patches.v11_0.drop_column_max_days_allowed
|
erpnext.patches.v11_0.drop_column_max_days_allowed
|
||||||
erpnext.patches.v11_0.change_healthcare_desktop_icons
|
erpnext.patches.v11_0.change_healthcare_desktop_icons
|
||||||
|
|||||||
@ -67,23 +67,16 @@ frappe.query_reports["Sales Analytics"] = {
|
|||||||
reqd: 1
|
reqd: 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"formatter": function(value, row, column, data) {
|
|
||||||
if(!value){
|
|
||||||
value = 0
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
},
|
|
||||||
get_datatable_options(options) {
|
get_datatable_options(options) {
|
||||||
return Object.assign(options, {
|
return Object.assign(options, {
|
||||||
checkboxColumn: true,
|
checkboxColumn: true,
|
||||||
events: {
|
events: {
|
||||||
onCheckRow: function(data) {
|
onCheckRow: function(data) {
|
||||||
row_name = data[2].content;
|
row_name = data[2].content;
|
||||||
row_values = data.slice(5).map(function (column) {
|
row_values = data.slice(4).map(function (column) {
|
||||||
return column.content;
|
return column.content;
|
||||||
})
|
})
|
||||||
|
entry = {
|
||||||
entry = {
|
|
||||||
'name':row_name,
|
'name':row_name,
|
||||||
'values':row_values
|
'values':row_values
|
||||||
}
|
}
|
||||||
|
|||||||
@ -275,7 +275,7 @@ class Analytics(object):
|
|||||||
self.parent_child_map = frappe._dict(frappe.db.sql(""" select name, supplier_group from `tabSupplier`"""))
|
self.parent_child_map = frappe._dict(frappe.db.sql(""" select name, supplier_group from `tabSupplier`"""))
|
||||||
|
|
||||||
def get_chart_data(self):
|
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 = {
|
self.chart = {
|
||||||
"data": {
|
"data": {
|
||||||
'labels': labels,
|
'labels': labels,
|
||||||
|
|||||||
@ -9,9 +9,6 @@ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_orde
|
|||||||
|
|
||||||
class TestAnalytics(unittest.TestCase):
|
class TestAnalytics(unittest.TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
frappe.db.sql(""" DELETE FROM `tabSales Order` """)
|
|
||||||
|
|
||||||
def test_by_entity(self):
|
def test_by_entity(self):
|
||||||
create_sales_order()
|
create_sales_order()
|
||||||
|
|
||||||
@ -20,7 +17,7 @@ class TestAnalytics(unittest.TestCase):
|
|||||||
'range': 'Monthly',
|
'range': 'Monthly',
|
||||||
'to_date': '2018-03-31',
|
'to_date': '2018-03-31',
|
||||||
'tree_type': 'Customer',
|
'tree_type': 'Customer',
|
||||||
'company': '_Test Company',
|
'company': '_Test Company 2',
|
||||||
'from_date': '2017-04-01',
|
'from_date': '2017-04-01',
|
||||||
'value_quantity': 'Value'
|
'value_quantity': 'Value'
|
||||||
}
|
}
|
||||||
@ -83,14 +80,13 @@ class TestAnalytics(unittest.TestCase):
|
|||||||
self.assertEqual(expected_data, report[1])
|
self.assertEqual(expected_data, report[1])
|
||||||
|
|
||||||
def test_by_group(self):
|
def test_by_group(self):
|
||||||
create_sales_order()
|
|
||||||
|
|
||||||
filters = {
|
filters = {
|
||||||
'doc_type': 'Sales Order',
|
'doc_type': 'Sales Order',
|
||||||
'range': 'Monthly',
|
'range': 'Monthly',
|
||||||
'to_date': '2018-03-31',
|
'to_date': '2018-03-31',
|
||||||
'tree_type': 'Customer Group',
|
'tree_type': 'Customer Group',
|
||||||
'company': '_Test Company',
|
'company': '_Test Company 2',
|
||||||
'from_date': '2017-04-01',
|
'from_date': '2017-04-01',
|
||||||
'value_quantity': 'Value'
|
'value_quantity': 'Value'
|
||||||
}
|
}
|
||||||
@ -170,14 +166,13 @@ class TestAnalytics(unittest.TestCase):
|
|||||||
self.assertEqual(expected_data, report[1])
|
self.assertEqual(expected_data, report[1])
|
||||||
|
|
||||||
def test_by_quantity(self):
|
def test_by_quantity(self):
|
||||||
create_sales_order()
|
|
||||||
|
|
||||||
filters = {
|
filters = {
|
||||||
'doc_type': 'Sales Order',
|
'doc_type': 'Sales Order',
|
||||||
'range': 'Monthly',
|
'range': 'Monthly',
|
||||||
'to_date': '2018-03-31',
|
'to_date': '2018-03-31',
|
||||||
'tree_type': 'Customer',
|
'tree_type': 'Customer',
|
||||||
'company': '_Test Company',
|
'company': '_Test Company 2',
|
||||||
'from_date': '2017-04-01',
|
'from_date': '2017-04-01',
|
||||||
'value_quantity': 'Quantity'
|
'value_quantity': 'Quantity'
|
||||||
}
|
}
|
||||||
@ -242,9 +237,39 @@ class TestAnalytics(unittest.TestCase):
|
|||||||
def create_sales_order():
|
def create_sales_order():
|
||||||
frappe.set_user("Administrator")
|
frappe.set_user("Administrator")
|
||||||
|
|
||||||
make_sales_order(qty=10, customer = "_Test Customer 1", transaction_date='2018-02-10')
|
make_sales_order(company="_Test Company 2", qty=10,
|
||||||
make_sales_order(qty=10, customer = "_Test Customer 1", transaction_date='2018-02-15')
|
customer = "_Test Customer 1",
|
||||||
make_sales_order(qty=15, customer = "_Test Customer 2", transaction_date='2017-09-23')
|
transaction_date = '2018-02-10',
|
||||||
make_sales_order(qty=10, customer = "_Test Customer 2", transaction_date='2017-10-10')
|
warehouse = 'Finished Goods - _TC2',
|
||||||
make_sales_order(qty=20, customer = "_Test Customer 3", transaction_date='2017-06-15')
|
currency = 'EUR')
|
||||||
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-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')
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user