Test case fixes
diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
index 0fe57e0..4f8fa9a 100644
--- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
+++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
@@ -169,7 +169,7 @@
frappe.throw(_("Row {0}: Credit entry can not be linked with a {1}").format(d.idx, doctype))
against_voucher = frappe.db.get_value(doctype, d.get(against_field),
- [scrub(d) for d in field_dict.get(doctype)])
+ [scrub(dt) for dt in field_dict.get(doctype)])
if against_field in ["against_invoice", "against_voucher"]:
if (against_voucher[0] !=d.party or against_voucher[1] != d.account):
diff --git a/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py
index 08f598d..3e6545a 100644
--- a/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py
+++ b/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py
@@ -42,7 +42,7 @@
if test_voucher.doctype == "Journal Voucher":
self.assertTrue(frappe.db.sql("""select name from `tabJournal Voucher Detail`
where account = %s and docstatus = 1 and parent = %s""",
- ("_Test Customer - _TC", test_voucher.name)))
+ ("_Test Receivable - _TC", test_voucher.name)))
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Voucher Detail`
where %s=%s""" % (field_dict.get(test_voucher.doctype), '%s'), (test_voucher.name)))
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index d4fcfc7..8e70fd6 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -27,7 +27,7 @@
dl = wrapper
expected_gl_entries = {
- "_Test Supplier - _TC": [0, 1512.30],
+ "_Test Payable - _TC": [0, 1512.30],
"_Test Account Cost for Goods Sold - _TC": [1250, 0],
"_Test Account Shipping Charges - _TC": [100, 0],
"_Test Account Excise Duty - _TC": [140, 0],
@@ -56,7 +56,7 @@
self.assertTrue(gl_entries)
expected_values = sorted([
- ["_Test Supplier - _TC", 0, 720],
+ ["_Test Payable - _TC", 0, 720],
["Stock Received But Not Billed - _TC", 750.0, 0],
["Expenses Included In Valuation - _TC", 0.0, 250.0],
["_Test Account Shipping Charges - _TC", 100.0, 0],
@@ -89,7 +89,7 @@
self.assertTrue(gl_entries)
expected_values = sorted([
- ["_Test Supplier - _TC", 0, 720],
+ ["_Test Payable - _TC", 0, 720],
["Stock Received But Not Billed - _TC", 500.0, 0],
["_Test Account Shipping Charges - _TC", 100.0, 0],
["_Test Account VAT - _TC", 120.0, 0],
@@ -120,7 +120,7 @@
self.assertTrue(gl_entries)
expected_values = sorted([
- ["_Test Supplier - _TC", 0, 620],
+ ["_Test Payable - _TC", 0, 620],
["_Test Account Cost for Goods Sold - _TC", 500.0, 0],
["_Test Account VAT - _TC", 120.0, 0],
])
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 9b8b47a..7b40c3e 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -362,7 +362,7 @@
# Amount should be credited
return flt(stock_rbnb) + flt(sys_bal)
-def get_outstanding_invoices(amount_query, account):
+def get_outstanding_invoices(amount_query, account, party_type, party):
all_outstanding_vouchers = []
outstanding_voucher_list = frappe.db.sql("""
select
@@ -371,9 +371,9 @@
from
`tabGL Entry`
where
- account = %s and {amount_query} > 0
+ account = %s and party_type=%s and party=%s and {amount_query} > 0
group by voucher_type, voucher_no
- """.format(amount_query = amount_query), account, as_dict = True)
+ """.format(amount_query = amount_query), (account, party_type, party), as_dict = True)
for d in outstanding_voucher_list:
payment_amount = frappe.db.sql("""
@@ -381,11 +381,11 @@
from
`tabGL Entry`
where
- account = %s and {amount_query} < 0
+ account = %s and party_type=%s and party=%s and {amount_query} < 0
and against_voucher_type = %s and ifnull(against_voucher, '') = %s
""".format(**{
"amount_query": amount_query
- }), (account, d.voucher_type, d.voucher_no))
+ }), (account, party_type, party, d.voucher_type, d.voucher_no))
payment_amount = -1*payment_amount[0][0] if payment_amount else 0
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index 83853dd..6612d30 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -85,6 +85,8 @@
self.assertEquals(pi.doctype, "Purchase Invoice")
self.assertEquals(len(pi.get("entries", [])), len(test_records[0]["po_details"]))
+
+ pi.credit_to = "_Test Payable - _TC"
pi.posting_date = "2013-05-12"
pi.bill_no = "NA"
frappe.get_doc(pi).insert()
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index b76efd8..b7e68d3 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -401,6 +401,7 @@
order by t1.posting_date""" %
(dr_or_cr, '%s', '%s', '%s', cond), tuple([account_head, party_type, party] + so_list), as_dict=1)
+
self.set(parentfield, [])
for d in res:
self.append(parentfield, {
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index c55b7b3..c7ec893 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -57,6 +57,7 @@
self.assertEquals(len(si.get("entries")), len(sales_order.get("sales_order_details")))
self.assertEquals(len(si.get("entries")), 1)
+ si.debit_to = "_Test Receivable - _TC"
si.posting_date = "2013-10-10"
si.insert()
si.submit()
diff --git a/erpnext/setup/doctype/customer_group/test_records.json b/erpnext/setup/doctype/customer_group/test_records.json
index a2dfba0..14d815c 100644
--- a/erpnext/setup/doctype/customer_group/test_records.json
+++ b/erpnext/setup/doctype/customer_group/test_records.json
@@ -1,8 +1,8 @@
[
{
- "customer_group_name": "_Test Customer Group",
- "doctype": "Customer Group",
- "is_group": "No",
+ "customer_group_name": "_Test Customer Group",
+ "doctype": "Customer Group",
+ "is_group": "No",
"parent_customer_group": "All Customer Groups"
}
-]
\ No newline at end of file
+]
diff --git a/erpnext/setup/doctype/supplier_type/test_records.json b/erpnext/setup/doctype/supplier_type/test_records.json
index a74c564..fd632c5 100644
--- a/erpnext/setup/doctype/supplier_type/test_records.json
+++ b/erpnext/setup/doctype/supplier_type/test_records.json
@@ -1,6 +1,6 @@
[
{
- "doctype": "Supplier Type",
+ "doctype": "Supplier Type",
"supplier_type": "_Test Supplier Type"
}
-]
\ No newline at end of file
+]
diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.js b/erpnext/setup/page/setup_wizard/setup_wizard.js
index 13ee85a..c02b5bf 100644
--- a/erpnext/setup/page/setup_wizard/setup_wizard.js
+++ b/erpnext/setup/page/setup_wizard/setup_wizard.js
@@ -133,8 +133,8 @@
options: "", fieldtype: 'Select'},
{fieldname:'timezone', label: __('Time Zone'), reqd:1,
options: "", fieldtype: 'Select'},
- // {fieldname:'chart_of_accounts', label: __('Chart of Accounts'),
- // options: "", fieldtype: 'Select'}
+ {fieldname:'chart_of_accounts', label: __('Chart of Accounts'),
+ options: "", fieldtype: 'Select'}
],
help: __('Select your home country and check the timezone and currency.'),
onload: function(slide, form) {
diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
index 5af9fb0..c2dcdc1 100644
--- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
@@ -10,7 +10,7 @@
from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import StockFreezeError
class TestStockEntry(unittest.TestCase):
-
+
def tearDown(self):
frappe.set_user("Administrator")
set_perpetual_inventory(0)
@@ -530,7 +530,8 @@
self.assertEqual(len(jv.get("entries")), 2)
self.assertEqual(jv.get("voucher_type"), "Debit Note")
self.assertEqual(jv.get("posting_date"), se.posting_date)
- self.assertEqual(jv.get("entries")[0].get("account"), "_Test Supplier - _TC")
+ self.assertEqual(jv.get("entries")[0].get("account"), "_Test Payable - _TC")
+ self.assertEqual(jv.get("entries")[0].get("party"), "_Test Supplier")
self.assertEqual(jv.get("entries")[1].get("account"), "_Test Account Cost for Goods Sold - _TC")
self.assertTrue(jv.get("entries")[0].get("against_voucher"))
@@ -823,19 +824,19 @@
se = frappe.copy_doc(test_records[0]).insert()
self.assertRaises (StockFreezeError, se.submit)
frappe.db.set_value("Stock Settings", None, "stock_frozen_upto_days", 0)
-
+
def test_production_order(self):
- bom_no = frappe.db.get_value("BOM", {"item": "_Test FG Item 2",
+ bom_no = frappe.db.get_value("BOM", {"item": "_Test FG Item 2",
"is_default": 1, "docstatus": 1})
-
+
production_order = frappe.new_doc("Production Order")
production_order.update({
"company": "_Test Company",
- "fg_warehouse": "_Test Warehouse 1 - _TC",
- "production_item": "_Test FG Item 2",
+ "fg_warehouse": "_Test Warehouse 1 - _TC",
+ "production_item": "_Test FG Item 2",
"bom_no": bom_no,
"qty": 1.0,
- "stock_uom": "Nos",
+ "stock_uom": "Nos",
"wip_warehouse": "_Test Warehouse - _TC"
})
production_order.insert()