fixes in Test Cases

This commit is contained in:
Neil Trini Lasrado 2015-04-29 12:13:21 +05:30
parent 349461e9e6
commit 01720404db
2 changed files with 13 additions and 4 deletions

View File

@ -364,8 +364,6 @@ class PurchaseInvoice(BuyingController):
)
if gl_entries:
for d in gl_entries:
print d.account, d.debit, d.credit
from erpnext.accounts.general_ledger import make_gl_entries
make_gl_entries(gl_entries, cancel=(self.docstatus == 2))

View File

@ -246,13 +246,15 @@ class TestPurchaseInvoice(unittest.TestCase):
"rate": 500,
"qty": 1,
"item_code": "_Test Item Home Desktop 100",
"expense_account": "_Test Account Cost for Goods Sold - _TC"
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"cost_center": "_Test Cost Center - _TC"
},
{
"rate": 1500,
"qty": 1,
"item_code": "_Test Item Home Desktop 200",
"expense_account": "_Test Account Cost for Goods Sold - _TC"
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"cost_center": "_Test Cost Center - _TC"
}
]
})
@ -260,6 +262,15 @@ class TestPurchaseInvoice(unittest.TestCase):
purchase_invoice.submit()
self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), 2000)
purchase_invoice1 = frappe.copy_doc(purchase_invoice)
purchase_invoice1.save()
purchase_invoice1.submit()
self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), 4000)
purchase_invoice1.cancel()
self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), 2000)
purchase_invoice.cancel()
self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), 0)