fix: Add test to check if SO can be cancelled when linked DN has been submitted

This commit is contained in:
GangaManoj
2021-10-26 21:41:47 +05:30
parent 21798d8836
commit aac574579a

View File

@@ -1279,7 +1279,7 @@ class TestSalesOrder(unittest.TestCase):
self.assertRaises(frappe.ValidationError, so.cancel) self.assertRaises(frappe.ValidationError, so.cancel)
def test_so_cancellation_when_si_has_been_submitted(self): def test_so_cancellation_after_si_submission(self):
""" """
Test to check if Sales Order gets cancelled when linked Sales Invoice has been Submitted Test to check if Sales Order gets cancelled when linked Sales Invoice has been Submitted
Expected result: Sales Order should not get cancelled Expected result: Sales Order should not get cancelled
@@ -1292,6 +1292,19 @@ class TestSalesOrder(unittest.TestCase):
so.load_from_db() so.load_from_db()
self.assertRaises(frappe.LinkExistsError, so.cancel) self.assertRaises(frappe.LinkExistsError, so.cancel)
def test_so_cancellation_after_dn_submission(self):
"""
Test to check if Sales Order gets cancelled when linked Delivery Note has been Submitted
Expected result: Sales Order should not get cancelled
"""
so = make_sales_order()
so.submit()
dn = make_delivery_note(so.name)
dn.submit()
so.load_from_db()
self.assertRaises(frappe.LinkExistsError, so.cancel)
def test_payment_terms_are_fetched_when_creating_sales_invoice(self): def test_payment_terms_are_fetched_when_creating_sales_invoice(self):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import ( from erpnext.accounts.doctype.payment_entry.test_payment_entry import (
create_payment_terms_template, create_payment_terms_template,