mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-14 04:15:10 +00:00
test: add unit test for canceling the common party advance jv created from sales invoice
This commit is contained in:
@@ -3175,6 +3175,50 @@ class TestSalesInvoice(FrappeTestCase):
|
||||
party_link.delete()
|
||||
frappe.db.set_single_value("Accounts Settings", "enable_common_party_accounting", 0)
|
||||
|
||||
def test_sales_invoice_cancel_with_common_party_advance_jv(self):
|
||||
from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import (
|
||||
make_customer,
|
||||
)
|
||||
from erpnext.accounts.doctype.party_link.party_link import create_party_link
|
||||
from erpnext.buying.doctype.supplier.test_supplier import create_supplier
|
||||
|
||||
# create a customer
|
||||
customer = make_customer(customer="_Test Common Supplier")
|
||||
# create a supplier
|
||||
supplier = create_supplier(supplier_name="_Test Common Supplier").name
|
||||
|
||||
# create a party link between customer & supplier
|
||||
party_link = create_party_link("Supplier", supplier, customer)
|
||||
|
||||
# enable common party accounting
|
||||
frappe.db.set_single_value("Accounts Settings", "enable_common_party_accounting", 1)
|
||||
|
||||
# create a sales invoice
|
||||
si = create_sales_invoice(customer=customer)
|
||||
|
||||
# check creation of journal entry
|
||||
jv = frappe.db.get_value(
|
||||
"Journal Entry Account",
|
||||
filters={
|
||||
"reference_type": si.doctype,
|
||||
"reference_name": si.name,
|
||||
"docstatus": 1,
|
||||
},
|
||||
fieldname="parent",
|
||||
)
|
||||
|
||||
self.assertTrue(jv)
|
||||
|
||||
# cancel sales invoice
|
||||
si.cancel()
|
||||
|
||||
# check cancellation of journal entry
|
||||
jv_status = frappe.db.get_value("Journal Entry", jv, "docstatus")
|
||||
self.assertEqual(jv_status, 2)
|
||||
|
||||
party_link.delete()
|
||||
frappe.db.set_single_value("Accounts Settings", "enable_common_party_accounting", 0)
|
||||
|
||||
def test_payment_statuses(self):
|
||||
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
|
||||
|
||||
|
||||
Reference in New Issue
Block a user