fix: Test Cases

This commit is contained in:
Deepesh Garg 2020-05-29 17:20:03 +05:30
parent c897e800ed
commit 52baf8f863
3 changed files with 20 additions and 11 deletions

View File

@ -1316,7 +1316,7 @@
"idx": 204,
"is_submittable": 1,
"links": [],
"modified": "2020-04-18 13:05:25.199832",
"modified": "2020-05-29 13:05:25.199832",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",

View File

@ -15,6 +15,7 @@ from erpnext.controllers.accounts_controller import get_payment_terms
from erpnext.exceptions import InvalidCurrency
from erpnext.stock.doctype.stock_entry.test_stock_entry import get_qty_after_transaction
from erpnext.accounts.doctype.account.test_account import get_inventory_account
from erpnext.projects.doctype.project.test_project import make_project
test_dependencies = ["Item", "Cost Center", "Payment Term", "Payment Terms Template"]
test_ignore = ["Serial No"]
@ -434,6 +435,8 @@ class TestPurchaseInvoice(unittest.TestCase):
)
def test_total_purchase_cost_for_project(self):
make_project({'project_name':'_Test Project'})
existing_purchase_cost = frappe.db.sql("""select sum(base_net_amount)
from `tabPurchase Invoice Item` where project = '_Test Project' and docstatus=1""")
existing_purchase_cost = existing_purchase_cost and existing_purchase_cost[0][0] or 0
@ -819,7 +822,7 @@ class TestPurchaseInvoice(unittest.TestCase):
"Creditors - _TC": {
"cost_center": cost_center
},
"_Test Account Cost for Goods Sold - _TC": {
"Cost of Goods Sold - _TC": {
"cost_center": cost_center
}
}
@ -858,8 +861,6 @@ class TestPurchaseInvoice(unittest.TestCase):
self.assertEqual(expected_values[gle.account]["cost_center"], gle.cost_center)
def test_purchase_invoice_with_project_link(self):
from erpnext.projects.doctype.project.test_project import make_project
project = make_project({
'project_name': 'Purchase Invoice Project',
'project_template_name': 'Test Project Template',

View File

@ -3,6 +3,7 @@
"company": "_Test Company",
"conversion_rate": 1.0,
"currency": "INR",
"cost_center": "_Test Cost Center - _TC",
"customer": "_Test Customer",
"customer_name": "_Test Customer",
"debit_to": "_Test Receivable - _TC",
@ -38,6 +39,7 @@
"description": "VAT",
"doctype": "Sales Taxes and Charges",
"parentfield": "taxes",
"cost_center": "_Test Cost Center - _TC",
"rate": 6
},
{
@ -46,6 +48,7 @@
"description": "Service Tax",
"doctype": "Sales Taxes and Charges",
"parentfield": "taxes",
"cost_center": "_Test Cost Center - _TC",
"rate": 6.36
}
],
@ -76,6 +79,7 @@
"customer_name": "_Test Customer",
"debit_to": "_Test Receivable - _TC",
"doctype": "Sales Invoice",
"cost_center": "_Test Cost Center - _TC",
"items": [
{
"amount": 500.0,
@ -108,6 +112,7 @@
"description": "VAT",
"doctype": "Sales Taxes and Charges",
"parentfield": "taxes",
"cost_center": "_Test Cost Center - _TC",
"rate": 16
},
{
@ -116,6 +121,7 @@
"description": "Service Tax",
"doctype": "Sales Taxes and Charges",
"parentfield": "taxes",
"cost_center": "_Test Cost Center - _TC",
"rate": 10
}
],
@ -132,6 +138,7 @@
"customer_name": "_Test Customer",
"debit_to": "_Test Receivable - _TC",
"doctype": "Sales Invoice",
"cost_center": "_Test Cost Center - _TC",
"items": [
{
"cost_center": "_Test Cost Center - _TC",
@ -259,6 +266,7 @@
"customer_name": "_Test Customer",
"debit_to": "_Test Receivable - _TC",
"doctype": "Sales Invoice",
"cost_center": "_Test Cost Center - _TC",
"items": [
{
"cost_center": "_Test Cost Center - _TC",