Skip to content

Commit

Permalink
test: differentiate progressing and non progressing flows
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed Apr 3, 2024
1 parent a8cd850 commit b4c815b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions erpnext/selling/doctype/sales_order/test_sales_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -1966,6 +1966,7 @@ def test_sales_order_advance_payment_status(self, mocked_get_payment_url):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request

# Flow progressing to SI with payment entries "moved" from SO to SI
so = make_sales_order(qty=1, rate=100, do_not_submit=True)
# no-op; for optical consistency with how a webshop SO would look like
so.order_type = "Shopping Cart"
Expand Down Expand Up @@ -1997,6 +1998,28 @@ def test_sales_order_advance_payment_status(self, mocked_get_payment_url):
frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Not Requested"
) # TODO: this might be a bug; handover has happened

# Flow NOT progressing to SI with payment entries NOT "moved"
so = make_sales_order(qty=1, rate=100)
self.assertEqual(frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Not Requested")

pr = make_payment_request(dt=so.doctype, dn=so.name, submit_doc=True, return_doc=True)
self.assertEqual(frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Requested")

pe = get_payment_entry(so.doctype, so.name).save().submit()
self.assertEqual(frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Fully Paid")

pe.reload()
pe.cancel()
self.assertEqual(
frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Requested"
) # here: reset

pr.reload()
pr.cancel()
self.assertEqual(
frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Not Requested"
) # here: reset

def test_pick_list_without_rejected_materials(self):
serial_and_batch_item = make_item(
"_Test Serial and Batch Item for Rejected Materials",
Expand Down

0 comments on commit b4c815b

Please sign in to comment.