Merge branch 'staging-fixes' into new-fix-branch
This commit is contained in:
commit
fc6194e640
2
.github/stale.yml
vendored
2
.github/stale.yml
vendored
@ -1,7 +1,7 @@
|
|||||||
# Configuration for probot-stale - https://github.com/probot/stale
|
# Configuration for probot-stale - https://github.com/probot/stale
|
||||||
|
|
||||||
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||||
daysUntilStale: 10
|
daysUntilStale: 30
|
||||||
|
|
||||||
# Number of days of inactivity before a stale Issue or Pull Request is closed.
|
# Number of days of inactivity before a stale Issue or Pull Request is closed.
|
||||||
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
||||||
|
@ -859,7 +859,8 @@ def make_stock_entry(source_name, target_doc=None):
|
|||||||
"Purchase Invoice Item": {
|
"Purchase Invoice Item": {
|
||||||
"doctype": "Stock Entry Detail",
|
"doctype": "Stock Entry Detail",
|
||||||
"field_map": {
|
"field_map": {
|
||||||
"stock_qty": "transfer_qty"
|
"stock_qty": "transfer_qty",
|
||||||
|
"batch_no": "batch_no"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}, target_doc)
|
}, target_doc)
|
||||||
|
@ -189,7 +189,7 @@ class ShareTransfer(Document):
|
|||||||
if (shareholder == 'from_shareholder') else self.to_folio_no;
|
if (shareholder == 'from_shareholder') else self.to_folio_no;
|
||||||
doc.save()
|
doc.save()
|
||||||
else:
|
else:
|
||||||
if doc.folio_no != (self.from_folio_no if (shareholder == 'from_shareholder') else self.to_folio_no):
|
if doc.folio_no and doc.folio_no != (self.from_folio_no if (shareholder == 'from_shareholder') else self.to_folio_no):
|
||||||
frappe.throw(_('The folio numbers are not matching'))
|
frappe.throw(_('The folio numbers are not matching'))
|
||||||
|
|
||||||
def autoname_folio(self, shareholder, is_company=False):
|
def autoname_folio(self, shareholder, is_company=False):
|
||||||
|
@ -79,7 +79,8 @@ class TestShareTransfer(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
for d in share_transfers:
|
for d in share_transfers:
|
||||||
frappe.get_doc(d).submit()
|
st = frappe.get_doc(d)
|
||||||
|
st.submit()
|
||||||
|
|
||||||
def test_invalid_share_transfer(self):
|
def test_invalid_share_transfer(self):
|
||||||
doc = frappe.get_doc({
|
doc = frappe.get_doc({
|
||||||
|
@ -36,10 +36,13 @@ class EmployeeBenefitClaim(Document):
|
|||||||
frappe.throw(_("Maximum benefit amount of employee {0} exceeds {1}").format(self.employee, max_benefits))
|
frappe.throw(_("Maximum benefit amount of employee {0} exceeds {1}").format(self.employee, max_benefits))
|
||||||
|
|
||||||
def validate_max_benefit_for_component(self, payroll_period):
|
def validate_max_benefit_for_component(self, payroll_period):
|
||||||
claimed_amount = self.claimed_amount
|
if self.max_amount_eligible:
|
||||||
claimed_amount += get_previous_claimed_amount(self.employee, payroll_period, component = self.earning_component)
|
claimed_amount = self.claimed_amount
|
||||||
if claimed_amount > self.max_amount_eligible:
|
claimed_amount += get_previous_claimed_amount(self.employee,
|
||||||
frappe.throw(_("Maximum amount eligible for the component {0} exceeds {1}").format(self.earning_component, self.max_amount_eligible))
|
payroll_period, component = self.earning_component)
|
||||||
|
if claimed_amount > self.max_amount_eligible:
|
||||||
|
frappe.throw(_("Maximum amount eligible for the component {0} exceeds {1}")
|
||||||
|
.format(self.earning_component, self.max_amount_eligible))
|
||||||
|
|
||||||
def validate_non_pro_rata_benefit_claim(self, max_benefits, payroll_period):
|
def validate_non_pro_rata_benefit_claim(self, max_benefits, payroll_period):
|
||||||
claimed_amount = self.claimed_amount
|
claimed_amount = self.claimed_amount
|
||||||
|
@ -14,7 +14,7 @@ frappe.ui.form.on("Job Offer", {
|
|||||||
|
|
||||||
refresh: function (frm) {
|
refresh: function (frm) {
|
||||||
if ((!frm.doc.__islocal) && (frm.doc.status == 'Accepted')
|
if ((!frm.doc.__islocal) && (frm.doc.status == 'Accepted')
|
||||||
&& (frm.doc.docstatus === 1) && (!frm.doc.__onload.employee)) {
|
&& (frm.doc.docstatus === 1) && (!frm.doc.__onload || !frm.doc.__onload.employee)) {
|
||||||
frm.add_custom_button(__('Make Employee'),
|
frm.add_custom_button(__('Make Employee'),
|
||||||
function () {
|
function () {
|
||||||
erpnext.job_offer.make_employee(frm);
|
erpnext.job_offer.make_employee(frm);
|
||||||
@ -22,7 +22,7 @@ frappe.ui.form.on("Job Offer", {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(frm.doc.__onload.employee) {
|
if(frm.doc.__onload && frm.doc.__onload.employee) {
|
||||||
frm.add_custom_button(__('Show Employee'),
|
frm.add_custom_button(__('Show Employee'),
|
||||||
function () {
|
function () {
|
||||||
frappe.set_route("Form", "Employee", frm.doc.__onload.employee);
|
frappe.set_route("Form", "Employee", frm.doc.__onload.employee);
|
||||||
|
@ -26,6 +26,7 @@ class TestSalarySlip(unittest.TestCase):
|
|||||||
self.make_holiday_list()
|
self.make_holiday_list()
|
||||||
|
|
||||||
frappe.db.set_value("Company", erpnext.get_default_company(), "default_holiday_list", "Salary Slip Test Holiday List")
|
frappe.db.set_value("Company", erpnext.get_default_company(), "default_holiday_list", "Salary Slip Test Holiday List")
|
||||||
|
frappe.db.set_value("HR Settings", None, "email_salary_slip_to_employee", 0)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
frappe.db.set_value("HR Settings", None, "include_holidays_in_total_working_days", 0)
|
frappe.db.set_value("HR Settings", None, "include_holidays_in_total_working_days", 0)
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
"rate": 5000.0,
|
"rate": 5000.0,
|
||||||
"uom": "_Test UOM",
|
"uom": "_Test UOM",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
"source_warehouse": "_Test Warehouse - _TC"
|
"source_warehouse": "_Test Warehouse - _TC",
|
||||||
|
"allow_transfer_for_manufacture": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amount": 2000.0,
|
"amount": 2000.0,
|
||||||
@ -21,7 +22,8 @@
|
|||||||
"rate": 1000.0,
|
"rate": 1000.0,
|
||||||
"uom": "_Test UOM",
|
"uom": "_Test UOM",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
"source_warehouse": "_Test Warehouse - _TC"
|
"source_warehouse": "_Test Warehouse - _TC",
|
||||||
|
"allow_transfer_for_manufacture": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"docstatus": 1,
|
"docstatus": 1,
|
||||||
@ -54,7 +56,8 @@
|
|||||||
"rate": 5000.0,
|
"rate": 5000.0,
|
||||||
"uom": "_Test UOM",
|
"uom": "_Test UOM",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
"source_warehouse": "_Test Warehouse - _TC"
|
"source_warehouse": "_Test Warehouse - _TC",
|
||||||
|
"allow_transfer_for_manufacture": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amount": 2000.0,
|
"amount": 2000.0,
|
||||||
@ -65,7 +68,8 @@
|
|||||||
"rate": 1000.0,
|
"rate": 1000.0,
|
||||||
"uom": "_Test UOM",
|
"uom": "_Test UOM",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
"source_warehouse": "_Test Warehouse - _TC"
|
"source_warehouse": "_Test Warehouse - _TC",
|
||||||
|
"allow_transfer_for_manufacture": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"docstatus": 1,
|
"docstatus": 1,
|
||||||
@ -97,7 +101,8 @@
|
|||||||
"rate": 5000.0,
|
"rate": 5000.0,
|
||||||
"uom": "_Test UOM",
|
"uom": "_Test UOM",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
"source_warehouse": "_Test Warehouse - _TC"
|
"source_warehouse": "_Test Warehouse - _TC",
|
||||||
|
"allow_transfer_for_manufacture": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amount": 3000.0,
|
"amount": 3000.0,
|
||||||
@ -109,7 +114,8 @@
|
|||||||
"rate": 1000.0,
|
"rate": 1000.0,
|
||||||
"uom": "_Test UOM",
|
"uom": "_Test UOM",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
"source_warehouse": "_Test Warehouse - _TC"
|
"source_warehouse": "_Test Warehouse - _TC",
|
||||||
|
"allow_transfer_for_manufacture": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"docstatus": 1,
|
"docstatus": 1,
|
||||||
@ -143,7 +149,8 @@
|
|||||||
"rate": 3000.0,
|
"rate": 3000.0,
|
||||||
"uom": "_Test UOM",
|
"uom": "_Test UOM",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
"source_warehouse": "_Test Warehouse - _TC"
|
"source_warehouse": "_Test Warehouse - _TC",
|
||||||
|
"allow_transfer_for_manufacture": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"docstatus": 1,
|
"docstatus": 1,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
"allow_copy": 0,
|
||||||
|
"allow_events_in_timeline": 0,
|
||||||
"allow_guest_to_view": 0,
|
"allow_guest_to_view": 0,
|
||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
@ -931,6 +932,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_from": "item_code.allow_transfer_for_manufacture",
|
||||||
"fieldname": "allow_transfer_for_manufacture",
|
"fieldname": "allow_transfer_for_manufacture",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -1033,8 +1035,8 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2018-09-16 19:59:36.636884",
|
"modified": "2018-11-22 15:04:55.187136",
|
||||||
"modified_by": "clarkejjm@gmail.com",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "BOM Item",
|
"name": "BOM Item",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
|
@ -191,7 +191,7 @@ def make_bom(**args):
|
|||||||
'qty': 1,
|
'qty': 1,
|
||||||
'uom': item_doc.stock_uom,
|
'uom': item_doc.stock_uom,
|
||||||
'stock_uom': item_doc.stock_uom,
|
'stock_uom': item_doc.stock_uom,
|
||||||
'rate': item_doc.valuation_rate or args.rate
|
'rate': item_doc.valuation_rate or args.rate,
|
||||||
})
|
})
|
||||||
|
|
||||||
bom.insert(ignore_permissions=True)
|
bom.insert(ignore_permissions=True)
|
||||||
|
@ -292,6 +292,7 @@ class TestWorkOrder(unittest.TestCase):
|
|||||||
make_bom(item=fg_item, rate=1000, raw_materials = ['_Test FG Item', '_Test FG Non Stock Item'])
|
make_bom(item=fg_item, rate=1000, raw_materials = ['_Test FG Item', '_Test FG Non Stock Item'])
|
||||||
|
|
||||||
wo = make_wo_order_test_record(production_item = fg_item)
|
wo = make_wo_order_test_record(production_item = fg_item)
|
||||||
|
|
||||||
se = frappe.get_doc(make_stock_entry(wo.name, "Material Transfer for Manufacture", 1))
|
se = frappe.get_doc(make_stock_entry(wo.name, "Material Transfer for Manufacture", 1))
|
||||||
se.insert()
|
se.insert()
|
||||||
se.submit()
|
se.submit()
|
||||||
|
@ -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
|
||||||
|
@ -350,12 +350,17 @@ def set_tax_withholding_category(company):
|
|||||||
|
|
||||||
def set_tds_account(docs, company):
|
def set_tds_account(docs, company):
|
||||||
abbr = frappe.get_value("Company", company, "abbr")
|
abbr = frappe.get_value("Company", company, "abbr")
|
||||||
docs.extend([
|
parent_account = frappe.db.get_value("Account", filters = {"account_name": "Duties and Taxes", "company": company})
|
||||||
{
|
if parent_account:
|
||||||
"doctype": "Account", "account_name": "TDS Payable", "account_type": "Tax",
|
docs.extend([
|
||||||
"parent_account": "Duties and Taxes - {0}".format(abbr), "company": company
|
{
|
||||||
}
|
"doctype": "Account",
|
||||||
])
|
"account_name": "TDS Payable",
|
||||||
|
"account_type": "Tax",
|
||||||
|
"parent_account": parent_account,
|
||||||
|
"company": company
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
def get_tds_details(accounts, fiscal_year):
|
def get_tds_details(accounts, fiscal_year):
|
||||||
# bootstrap default tax withholding sections
|
# bootstrap default tax withholding sections
|
||||||
|
@ -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,
|
||||||
|
@ -8,19 +8,23 @@ from erpnext.selling.report.sales_analytics.sales_analytics import execute
|
|||||||
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
|
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
|
||||||
|
|
||||||
class TestAnalytics(unittest.TestCase):
|
class TestAnalytics(unittest.TestCase):
|
||||||
|
def test_sales_analytics(self):
|
||||||
|
frappe.db.sql("delete from `tabSales Order` where company='_Test Company 2'")
|
||||||
|
|
||||||
def tearDown(self):
|
create_sales_orders()
|
||||||
frappe.db.sql(""" DELETE FROM `tabSales Order` """)
|
|
||||||
|
|
||||||
def test_by_entity(self):
|
self.compare_result_for_customer()
|
||||||
create_sales_order()
|
self.compare_result_for_customer_group()
|
||||||
|
self.compare_result_for_customer_based_on_quantity()
|
||||||
|
|
||||||
|
|
||||||
|
def compare_result_for_customer(self):
|
||||||
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': 'Value'
|
'value_quantity': 'Value'
|
||||||
}
|
}
|
||||||
@ -45,23 +49,6 @@ class TestAnalytics(unittest.TestCase):
|
|||||||
"mar": 0.0,
|
"mar": 0.0,
|
||||||
"total":2000.0
|
"total":2000.0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"entity": "_Test Customer 3",
|
|
||||||
"entity_name": "_Test Customer 3",
|
|
||||||
"apr": 0.0,
|
|
||||||
"may": 0.0,
|
|
||||||
"jun": 2000.0,
|
|
||||||
"jul": 1000.0,
|
|
||||||
"aug": 0.0,
|
|
||||||
"sep": 0.0,
|
|
||||||
"oct": 0.0,
|
|
||||||
"nov": 0.0,
|
|
||||||
"dec": 0.0,
|
|
||||||
"jan": 0.0,
|
|
||||||
"feb": 0.0,
|
|
||||||
"mar": 0.0,
|
|
||||||
"total": 3000.0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"entity": "_Test Customer 2",
|
"entity": "_Test Customer 2",
|
||||||
"entity_name": "_Test Customer 2",
|
"entity_name": "_Test Customer 2",
|
||||||
@ -78,106 +65,67 @@ class TestAnalytics(unittest.TestCase):
|
|||||||
"feb": 0.0,
|
"feb": 0.0,
|
||||||
"mar": 0.0,
|
"mar": 0.0,
|
||||||
"total":2500.0
|
"total":2500.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"entity": "_Test Customer 3",
|
||||||
|
"entity_name": "_Test Customer 3",
|
||||||
|
"apr": 0.0,
|
||||||
|
"may": 0.0,
|
||||||
|
"jun": 2000.0,
|
||||||
|
"jul": 1000.0,
|
||||||
|
"aug": 0.0,
|
||||||
|
"sep": 0.0,
|
||||||
|
"oct": 0.0,
|
||||||
|
"nov": 0.0,
|
||||||
|
"dec": 0.0,
|
||||||
|
"jan": 0.0,
|
||||||
|
"feb": 0.0,
|
||||||
|
"mar": 0.0,
|
||||||
|
"total": 3000.0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
self.assertEqual(expected_data, report[1])
|
result = sorted(report[1], key=lambda k: k['entity'])
|
||||||
|
self.assertEqual(expected_data, result)
|
||||||
def test_by_group(self):
|
|
||||||
create_sales_order()
|
|
||||||
|
|
||||||
|
def compare_result_for_customer_group(self):
|
||||||
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'
|
||||||
}
|
}
|
||||||
|
|
||||||
report = execute(filters)
|
report = execute(filters)
|
||||||
|
|
||||||
expected_data = [
|
expected_first_row = {
|
||||||
{
|
"entity": "All Customer Groups",
|
||||||
"entity": "All Customer Groups",
|
"indent": 0,
|
||||||
"indent": 0,
|
"apr": 0.0,
|
||||||
"apr": 0.0,
|
"may": 0.0,
|
||||||
"may": 0.0,
|
"jun": 2000.0,
|
||||||
"jun": 2000.0,
|
"jul": 1000.0,
|
||||||
"jul": 1000.0,
|
"aug": 0.0,
|
||||||
"aug": 0.0,
|
"sep": 1500.0,
|
||||||
"sep": 1500.0,
|
"oct": 1000.0,
|
||||||
"oct": 1000.0,
|
"nov": 0.0,
|
||||||
"nov": 0.0,
|
"dec": 0.0,
|
||||||
"dec": 0.0,
|
"jan": 0.0,
|
||||||
"jan": 0.0,
|
"feb": 2000.0,
|
||||||
"feb": 2000.0,
|
"mar": 0.0,
|
||||||
"mar": 0.0,
|
"total":7500.0
|
||||||
"total":7500.0
|
}
|
||||||
},
|
self.assertEqual(expected_first_row, report[1][0])
|
||||||
{
|
|
||||||
"entity": "Individual",
|
|
||||||
"indent": 1,
|
|
||||||
"apr": 0.0,
|
|
||||||
"may": 0.0,
|
|
||||||
"jun": 0.0,
|
|
||||||
"jul": 0.0,
|
|
||||||
"aug": 0.0,
|
|
||||||
"sep": 0.0,
|
|
||||||
"oct": 0.0,
|
|
||||||
"nov": 0.0,
|
|
||||||
"dec": 0.0,
|
|
||||||
"jan": 0.0,
|
|
||||||
"feb": 0.0,
|
|
||||||
"mar": 0.0,
|
|
||||||
"total": 0.0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"entity": "_Test Customer Group",
|
|
||||||
"indent": 1,
|
|
||||||
"apr": 0.0,
|
|
||||||
"may": 0.0,
|
|
||||||
"jun": 0.0,
|
|
||||||
"jul": 0.0,
|
|
||||||
"aug": 0.0,
|
|
||||||
"sep": 0.0,
|
|
||||||
"oct": 0.0,
|
|
||||||
"nov": 0.0,
|
|
||||||
"dec": 0.0,
|
|
||||||
"jan": 0.0,
|
|
||||||
"feb": 0.0,
|
|
||||||
"mar": 0.0,
|
|
||||||
"total":0.0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"entity": "_Test Customer Group 1",
|
|
||||||
"indent": 1,
|
|
||||||
"apr": 0.0,
|
|
||||||
"may": 0.0,
|
|
||||||
"jun": 0.0,
|
|
||||||
"jul": 0.0,
|
|
||||||
"aug": 0.0,
|
|
||||||
"sep": 0.0,
|
|
||||||
"oct": 0.0,
|
|
||||||
"nov": 0.0,
|
|
||||||
"dec": 0.0,
|
|
||||||
"jan": 0.0,
|
|
||||||
"feb": 0.0,
|
|
||||||
"mar": 0.0,
|
|
||||||
"total":0.0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
self.assertEqual(expected_data, report[1])
|
|
||||||
|
|
||||||
def test_by_quantity(self):
|
|
||||||
create_sales_order()
|
|
||||||
|
|
||||||
|
def compare_result_for_customer_based_on_quantity(self):
|
||||||
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'
|
||||||
}
|
}
|
||||||
@ -202,23 +150,6 @@ class TestAnalytics(unittest.TestCase):
|
|||||||
"mar": 0.0,
|
"mar": 0.0,
|
||||||
"total":20.0
|
"total":20.0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"entity": "_Test Customer 3",
|
|
||||||
"entity_name": "_Test Customer 3",
|
|
||||||
"apr": 0.0,
|
|
||||||
"may": 0.0,
|
|
||||||
"jun": 20.0,
|
|
||||||
"jul": 10.0,
|
|
||||||
"aug": 0.0,
|
|
||||||
"sep": 0.0,
|
|
||||||
"oct": 0.0,
|
|
||||||
"nov": 0.0,
|
|
||||||
"dec": 0.0,
|
|
||||||
"jan": 0.0,
|
|
||||||
"feb": 0.0,
|
|
||||||
"mar": 0.0,
|
|
||||||
"total": 30.0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"entity": "_Test Customer 2",
|
"entity": "_Test Customer 2",
|
||||||
"entity_name": "_Test Customer 2",
|
"entity_name": "_Test Customer 2",
|
||||||
@ -235,16 +166,63 @@ class TestAnalytics(unittest.TestCase):
|
|||||||
"feb": 0.0,
|
"feb": 0.0,
|
||||||
"mar": 0.0,
|
"mar": 0.0,
|
||||||
"total":25.0
|
"total":25.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"entity": "_Test Customer 3",
|
||||||
|
"entity_name": "_Test Customer 3",
|
||||||
|
"apr": 0.0,
|
||||||
|
"may": 0.0,
|
||||||
|
"jun": 20.0,
|
||||||
|
"jul": 10.0,
|
||||||
|
"aug": 0.0,
|
||||||
|
"sep": 0.0,
|
||||||
|
"oct": 0.0,
|
||||||
|
"nov": 0.0,
|
||||||
|
"dec": 0.0,
|
||||||
|
"jan": 0.0,
|
||||||
|
"feb": 0.0,
|
||||||
|
"mar": 0.0,
|
||||||
|
"total": 30.0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
self.assertEqual(expected_data, report[1])
|
result = sorted(report[1], key=lambda k: k['entity'])
|
||||||
|
self.assertEqual(expected_data, result)
|
||||||
|
|
||||||
def create_sales_order():
|
def create_sales_orders():
|
||||||
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')
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
"show_in_website": 1,
|
"show_in_website": 1,
|
||||||
"website_warehouse": "_Test Warehouse - _TC",
|
"website_warehouse": "_Test Warehouse - _TC",
|
||||||
|
"gst_hsn_code": "999800",
|
||||||
"item_defaults": [{
|
"item_defaults": [{
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"default_warehouse": "_Test Warehouse - _TC",
|
"default_warehouse": "_Test Warehouse - _TC",
|
||||||
@ -78,6 +79,7 @@
|
|||||||
"item_group": "_Test Item Group Desktops",
|
"item_group": "_Test Item Group Desktops",
|
||||||
"item_name": "_Test Item Home Desktop 100",
|
"item_name": "_Test Item Home Desktop 100",
|
||||||
"valuation_rate": 100,
|
"valuation_rate": 100,
|
||||||
|
"gst_hsn_code": "999800",
|
||||||
"item_defaults": [{
|
"item_defaults": [{
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"default_warehouse": "_Test Warehouse - _TC",
|
"default_warehouse": "_Test Warehouse - _TC",
|
||||||
@ -107,6 +109,7 @@
|
|||||||
"item_group": "_Test Item Group Desktops",
|
"item_group": "_Test Item Group Desktops",
|
||||||
"item_name": "_Test Item Home Desktop 200",
|
"item_name": "_Test Item Home Desktop 200",
|
||||||
"stock_uom": "_Test UOM 1",
|
"stock_uom": "_Test UOM 1",
|
||||||
|
"gst_hsn_code": "999800",
|
||||||
"item_defaults": [{
|
"item_defaults": [{
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"default_warehouse": "_Test Warehouse - _TC",
|
"default_warehouse": "_Test Warehouse - _TC",
|
||||||
@ -128,6 +131,7 @@
|
|||||||
"item_group": "_Test Item Group Desktops",
|
"item_group": "_Test Item Group Desktops",
|
||||||
"item_name": "_Test Product Bundle Item",
|
"item_name": "_Test Product Bundle Item",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
|
"gst_hsn_code": "999800",
|
||||||
"item_defaults": [{
|
"item_defaults": [{
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"default_warehouse": "_Test Warehouse - _TC",
|
"default_warehouse": "_Test Warehouse - _TC",
|
||||||
@ -149,6 +153,7 @@
|
|||||||
"item_group": "_Test Item Group Desktops",
|
"item_group": "_Test Item Group Desktops",
|
||||||
"item_name": "_Test FG Item",
|
"item_name": "_Test FG Item",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
|
"gst_hsn_code": "999800",
|
||||||
"item_defaults": [{
|
"item_defaults": [{
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"default_warehouse": "_Test Warehouse - _TC",
|
"default_warehouse": "_Test Warehouse - _TC",
|
||||||
@ -170,6 +175,7 @@
|
|||||||
"item_group": "_Test Item Group Desktops",
|
"item_group": "_Test Item Group Desktops",
|
||||||
"item_name": "_Test Non Stock Item",
|
"item_name": "_Test Non Stock Item",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
|
"gst_hsn_code": "999800",
|
||||||
"item_defaults": [{
|
"item_defaults": [{
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"default_warehouse": "_Test Warehouse - _TC",
|
"default_warehouse": "_Test Warehouse - _TC",
|
||||||
@ -191,6 +197,7 @@
|
|||||||
"item_group": "_Test Item Group Desktops",
|
"item_group": "_Test Item Group Desktops",
|
||||||
"item_name": "_Test Serialized Item",
|
"item_name": "_Test Serialized Item",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
|
"gst_hsn_code": "999800",
|
||||||
"item_defaults": [{
|
"item_defaults": [{
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"default_warehouse": "_Test Warehouse - _TC",
|
"default_warehouse": "_Test Warehouse - _TC",
|
||||||
@ -213,6 +220,7 @@
|
|||||||
"item_name": "_Test Serialized Item With Series",
|
"item_name": "_Test Serialized Item With Series",
|
||||||
"serial_no_series": "ABCD.#####",
|
"serial_no_series": "ABCD.#####",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
|
"gst_hsn_code": "999800",
|
||||||
"item_defaults": [{
|
"item_defaults": [{
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"default_warehouse": "_Test Warehouse - _TC",
|
"default_warehouse": "_Test Warehouse - _TC",
|
||||||
@ -234,6 +242,7 @@
|
|||||||
"item_group": "_Test Item Group Desktops",
|
"item_group": "_Test Item Group Desktops",
|
||||||
"item_name": "_Test Item Home Desktop Manufactured",
|
"item_name": "_Test Item Home Desktop Manufactured",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
|
"gst_hsn_code": "999800",
|
||||||
"item_defaults": [{
|
"item_defaults": [{
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"default_warehouse": "_Test Warehouse - _TC",
|
"default_warehouse": "_Test Warehouse - _TC",
|
||||||
@ -255,6 +264,7 @@
|
|||||||
"item_group": "_Test Item Group Desktops",
|
"item_group": "_Test Item Group Desktops",
|
||||||
"item_name": "_Test FG Item 2",
|
"item_name": "_Test FG Item 2",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
|
"gst_hsn_code": "999800",
|
||||||
"item_defaults": [{
|
"item_defaults": [{
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"default_warehouse": "_Test Warehouse - _TC",
|
"default_warehouse": "_Test Warehouse - _TC",
|
||||||
@ -276,6 +286,7 @@
|
|||||||
"item_group": "_Test Item Group Desktops",
|
"item_group": "_Test Item Group Desktops",
|
||||||
"item_name": "_Test Variant Item",
|
"item_name": "_Test Variant Item",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
|
"gst_hsn_code": "999800",
|
||||||
"has_variants": 1,
|
"has_variants": 1,
|
||||||
"item_defaults": [{
|
"item_defaults": [{
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
@ -312,6 +323,7 @@
|
|||||||
"item_group": "_Test Item Group",
|
"item_group": "_Test Item Group",
|
||||||
"item_name": "_Test Item Warehouse Group Wise Reorder",
|
"item_name": "_Test Item Warehouse Group Wise Reorder",
|
||||||
"apply_warehouse_wise_reorder_level": 1,
|
"apply_warehouse_wise_reorder_level": 1,
|
||||||
|
"gst_hsn_code": "999800",
|
||||||
"item_defaults": [{
|
"item_defaults": [{
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"default_warehouse": "_Test Warehouse Group-C1 - _TC",
|
"default_warehouse": "_Test Warehouse Group-C1 - _TC",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user