From 499144fd862543f0ff995e0effcb3d03bb0a18a8 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 4 Aug 2017 12:55:44 +0530 Subject: [PATCH] Fixed test cases for dynamic link order --- .../doctype/sales_invoice/test_sales_invoice.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 01071c53fc..44a0a8caaa 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -120,10 +120,6 @@ class TestSalesInvoice(unittest.TestCase): pe.insert() pe.submit() - link_data = get_dynamic_link_map().get('Sales Invoice', []) - link_doctypes = [d.parent for d in link_data] - self.assertEquals(link_doctypes[-1], 'GL Entry') - unlink_payment_on_cancel_of_invoice(0) si = frappe.get_doc('Sales Invoice', si.name) self.assertRaises(frappe.LinkExistsError, si.cancel) @@ -490,6 +486,12 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(frappe.db.get_value("Sales Invoice", w.name, "outstanding_amount"), 161.8) + link_data = get_dynamic_link_map().get('Sales Invoice', []) + link_doctypes = [d.parent for d in link_data] + + # test case for dynamic link order + self.assertTrue(link_doctypes.index('GL Entry') > link_doctypes.index('Journal Entry Account')) + jv.cancel() self.assertEquals(frappe.db.get_value("Sales Invoice", w.name, "outstanding_amount"), 561.8)