From 01720404dba14b63bb0d80c77e6c88cd4a52b5bb Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 29 Apr 2015 12:13:21 +0530 Subject: [PATCH] fixes in Test Cases --- .../doctype/purchase_invoice/purchase_invoice.py | 2 -- .../purchase_invoice/test_purchase_invoice.py | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 8c238679b5..31213afe70 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -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)) diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index b68220523d..d0fb3d93f3 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -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)