From 0c1d441aa36378bdd2cd448966b508eea5f482ec Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 4 Aug 2017 10:55:46 +0530 Subject: [PATCH] Test case for dynamic link order (#10276) --- erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 90b36e0688..01071c53fc 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe import unittest, copy from frappe.utils import nowdate, add_days, flt +from frappe.model.dynamic_links import get_dynamic_link_map from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry, get_qty_after_transaction from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import unlink_payment_on_cancel_of_invoice from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile @@ -119,6 +120,10 @@ 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)