Test case fixes
This commit is contained in:
parent
678b441082
commit
997a7a1d3e
@ -169,7 +169,7 @@ class JournalVoucher(AccountsController):
|
|||||||
frappe.throw(_("Row {0}: Credit entry can not be linked with a {1}").format(d.idx, doctype))
|
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),
|
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_field in ["against_invoice", "against_voucher"]:
|
||||||
if (against_voucher[0] !=d.party or against_voucher[1] != d.account):
|
if (against_voucher[0] !=d.party or against_voucher[1] != d.account):
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class TestJournalVoucher(unittest.TestCase):
|
|||||||
if test_voucher.doctype == "Journal Voucher":
|
if test_voucher.doctype == "Journal Voucher":
|
||||||
self.assertTrue(frappe.db.sql("""select name from `tabJournal Voucher Detail`
|
self.assertTrue(frappe.db.sql("""select name from `tabJournal Voucher Detail`
|
||||||
where account = %s and docstatus = 1 and parent = %s""",
|
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`
|
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)))
|
where %s=%s""" % (field_dict.get(test_voucher.doctype), '%s'), (test_voucher.name)))
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
dl = wrapper
|
dl = wrapper
|
||||||
|
|
||||||
expected_gl_entries = {
|
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 Cost for Goods Sold - _TC": [1250, 0],
|
||||||
"_Test Account Shipping Charges - _TC": [100, 0],
|
"_Test Account Shipping Charges - _TC": [100, 0],
|
||||||
"_Test Account Excise Duty - _TC": [140, 0],
|
"_Test Account Excise Duty - _TC": [140, 0],
|
||||||
@ -56,7 +56,7 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
self.assertTrue(gl_entries)
|
self.assertTrue(gl_entries)
|
||||||
|
|
||||||
expected_values = sorted([
|
expected_values = sorted([
|
||||||
["_Test Supplier - _TC", 0, 720],
|
["_Test Payable - _TC", 0, 720],
|
||||||
["Stock Received But Not Billed - _TC", 750.0, 0],
|
["Stock Received But Not Billed - _TC", 750.0, 0],
|
||||||
["Expenses Included In Valuation - _TC", 0.0, 250.0],
|
["Expenses Included In Valuation - _TC", 0.0, 250.0],
|
||||||
["_Test Account Shipping Charges - _TC", 100.0, 0],
|
["_Test Account Shipping Charges - _TC", 100.0, 0],
|
||||||
@ -89,7 +89,7 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
self.assertTrue(gl_entries)
|
self.assertTrue(gl_entries)
|
||||||
|
|
||||||
expected_values = sorted([
|
expected_values = sorted([
|
||||||
["_Test Supplier - _TC", 0, 720],
|
["_Test Payable - _TC", 0, 720],
|
||||||
["Stock Received But Not Billed - _TC", 500.0, 0],
|
["Stock Received But Not Billed - _TC", 500.0, 0],
|
||||||
["_Test Account Shipping Charges - _TC", 100.0, 0],
|
["_Test Account Shipping Charges - _TC", 100.0, 0],
|
||||||
["_Test Account VAT - _TC", 120.0, 0],
|
["_Test Account VAT - _TC", 120.0, 0],
|
||||||
@ -120,7 +120,7 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
self.assertTrue(gl_entries)
|
self.assertTrue(gl_entries)
|
||||||
|
|
||||||
expected_values = sorted([
|
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 Cost for Goods Sold - _TC", 500.0, 0],
|
||||||
["_Test Account VAT - _TC", 120.0, 0],
|
["_Test Account VAT - _TC", 120.0, 0],
|
||||||
])
|
])
|
||||||
|
|||||||
@ -362,7 +362,7 @@ def get_stock_rbnb_difference(posting_date, company):
|
|||||||
# Amount should be credited
|
# Amount should be credited
|
||||||
return flt(stock_rbnb) + flt(sys_bal)
|
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 = []
|
all_outstanding_vouchers = []
|
||||||
outstanding_voucher_list = frappe.db.sql("""
|
outstanding_voucher_list = frappe.db.sql("""
|
||||||
select
|
select
|
||||||
@ -371,9 +371,9 @@ def get_outstanding_invoices(amount_query, account):
|
|||||||
from
|
from
|
||||||
`tabGL Entry`
|
`tabGL Entry`
|
||||||
where
|
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
|
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:
|
for d in outstanding_voucher_list:
|
||||||
payment_amount = frappe.db.sql("""
|
payment_amount = frappe.db.sql("""
|
||||||
@ -381,11 +381,11 @@ def get_outstanding_invoices(amount_query, account):
|
|||||||
from
|
from
|
||||||
`tabGL Entry`
|
`tabGL Entry`
|
||||||
where
|
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
|
and against_voucher_type = %s and ifnull(against_voucher, '') = %s
|
||||||
""".format(**{
|
""".format(**{
|
||||||
"amount_query": amount_query
|
"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
|
payment_amount = -1*payment_amount[0][0] if payment_amount else 0
|
||||||
|
|
||||||
|
|||||||
@ -85,6 +85,8 @@ class TestPurchaseOrder(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEquals(pi.doctype, "Purchase Invoice")
|
self.assertEquals(pi.doctype, "Purchase Invoice")
|
||||||
self.assertEquals(len(pi.get("entries", [])), len(test_records[0]["po_details"]))
|
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.posting_date = "2013-05-12"
|
||||||
pi.bill_no = "NA"
|
pi.bill_no = "NA"
|
||||||
frappe.get_doc(pi).insert()
|
frappe.get_doc(pi).insert()
|
||||||
|
|||||||
@ -401,6 +401,7 @@ class AccountsController(TransactionBase):
|
|||||||
order by t1.posting_date""" %
|
order by t1.posting_date""" %
|
||||||
(dr_or_cr, '%s', '%s', '%s', cond), tuple([account_head, party_type, party] + so_list), as_dict=1)
|
(dr_or_cr, '%s', '%s', '%s', cond), tuple([account_head, party_type, party] + so_list), as_dict=1)
|
||||||
|
|
||||||
|
|
||||||
self.set(parentfield, [])
|
self.set(parentfield, [])
|
||||||
for d in res:
|
for d in res:
|
||||||
self.append(parentfield, {
|
self.append(parentfield, {
|
||||||
|
|||||||
@ -57,6 +57,7 @@ class TestSalesOrder(unittest.TestCase):
|
|||||||
self.assertEquals(len(si.get("entries")), len(sales_order.get("sales_order_details")))
|
self.assertEquals(len(si.get("entries")), len(sales_order.get("sales_order_details")))
|
||||||
self.assertEquals(len(si.get("entries")), 1)
|
self.assertEquals(len(si.get("entries")), 1)
|
||||||
|
|
||||||
|
si.debit_to = "_Test Receivable - _TC"
|
||||||
si.posting_date = "2013-10-10"
|
si.posting_date = "2013-10-10"
|
||||||
si.insert()
|
si.insert()
|
||||||
si.submit()
|
si.submit()
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"customer_group_name": "_Test Customer Group",
|
"customer_group_name": "_Test Customer Group",
|
||||||
"doctype": "Customer Group",
|
"doctype": "Customer Group",
|
||||||
"is_group": "No",
|
"is_group": "No",
|
||||||
"parent_customer_group": "All Customer Groups"
|
"parent_customer_group": "All Customer Groups"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"doctype": "Supplier Type",
|
"doctype": "Supplier Type",
|
||||||
"supplier_type": "_Test Supplier Type"
|
"supplier_type": "_Test Supplier Type"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -133,8 +133,8 @@ frappe.pages['setup-wizard'].onload = function(wrapper) {
|
|||||||
options: "", fieldtype: 'Select'},
|
options: "", fieldtype: 'Select'},
|
||||||
{fieldname:'timezone', label: __('Time Zone'), reqd:1,
|
{fieldname:'timezone', label: __('Time Zone'), reqd:1,
|
||||||
options: "", fieldtype: 'Select'},
|
options: "", fieldtype: 'Select'},
|
||||||
// {fieldname:'chart_of_accounts', label: __('Chart of Accounts'),
|
{fieldname:'chart_of_accounts', label: __('Chart of Accounts'),
|
||||||
// options: "", fieldtype: 'Select'}
|
options: "", fieldtype: 'Select'}
|
||||||
],
|
],
|
||||||
help: __('Select your home country and check the timezone and currency.'),
|
help: __('Select your home country and check the timezone and currency.'),
|
||||||
onload: function(slide, form) {
|
onload: function(slide, form) {
|
||||||
|
|||||||
@ -10,7 +10,7 @@ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_per
|
|||||||
from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import StockFreezeError
|
from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import StockFreezeError
|
||||||
|
|
||||||
class TestStockEntry(unittest.TestCase):
|
class TestStockEntry(unittest.TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
frappe.set_user("Administrator")
|
frappe.set_user("Administrator")
|
||||||
set_perpetual_inventory(0)
|
set_perpetual_inventory(0)
|
||||||
@ -530,7 +530,8 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
self.assertEqual(len(jv.get("entries")), 2)
|
self.assertEqual(len(jv.get("entries")), 2)
|
||||||
self.assertEqual(jv.get("voucher_type"), "Debit Note")
|
self.assertEqual(jv.get("voucher_type"), "Debit Note")
|
||||||
self.assertEqual(jv.get("posting_date"), se.posting_date)
|
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.assertEqual(jv.get("entries")[1].get("account"), "_Test Account Cost for Goods Sold - _TC")
|
||||||
self.assertTrue(jv.get("entries")[0].get("against_voucher"))
|
self.assertTrue(jv.get("entries")[0].get("against_voucher"))
|
||||||
|
|
||||||
@ -823,19 +824,19 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
se = frappe.copy_doc(test_records[0]).insert()
|
se = frappe.copy_doc(test_records[0]).insert()
|
||||||
self.assertRaises (StockFreezeError, se.submit)
|
self.assertRaises (StockFreezeError, se.submit)
|
||||||
frappe.db.set_value("Stock Settings", None, "stock_frozen_upto_days", 0)
|
frappe.db.set_value("Stock Settings", None, "stock_frozen_upto_days", 0)
|
||||||
|
|
||||||
def test_production_order(self):
|
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})
|
"is_default": 1, "docstatus": 1})
|
||||||
|
|
||||||
production_order = frappe.new_doc("Production Order")
|
production_order = frappe.new_doc("Production Order")
|
||||||
production_order.update({
|
production_order.update({
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"fg_warehouse": "_Test Warehouse 1 - _TC",
|
"fg_warehouse": "_Test Warehouse 1 - _TC",
|
||||||
"production_item": "_Test FG Item 2",
|
"production_item": "_Test FG Item 2",
|
||||||
"bom_no": bom_no,
|
"bom_no": bom_no,
|
||||||
"qty": 1.0,
|
"qty": 1.0,
|
||||||
"stock_uom": "Nos",
|
"stock_uom": "Nos",
|
||||||
"wip_warehouse": "_Test Warehouse - _TC"
|
"wip_warehouse": "_Test Warehouse - _TC"
|
||||||
})
|
})
|
||||||
production_order.insert()
|
production_order.insert()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user