mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 20:29:09 +00:00
test: trigger so to invoice flow (fails)
This commit is contained in:
@@ -1960,22 +1960,36 @@ class TestSalesOrder(FrappeTestCase):
|
|||||||
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
|
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
|
from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request
|
||||||
|
|
||||||
so = make_sales_order(qty=1, rate=100)
|
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"
|
||||||
|
so.submit()
|
||||||
self.assertEqual(frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Not Requested")
|
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)
|
pr = make_payment_request(
|
||||||
|
dt=so.doctype, dn=so.name, order_type="Shopping Cart", submit_doc=True, return_doc=True
|
||||||
|
)
|
||||||
self.assertEqual(frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Requested")
|
self.assertEqual(frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Requested")
|
||||||
|
|
||||||
pe = get_payment_entry(so.doctype, so.name).save().submit()
|
pe = pr.set_as_paid()
|
||||||
|
pr.reload() # status updated
|
||||||
|
pe.reload() # references moved to Sales Invoice
|
||||||
|
self.assertEqual(pr.status, "Paid")
|
||||||
|
self.assertEqual(pe.references[0].reference_doctype, "Sales Invoice")
|
||||||
self.assertEqual(frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Fully Paid")
|
self.assertEqual(frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Fully Paid")
|
||||||
|
|
||||||
pe.reload()
|
|
||||||
pe.cancel()
|
pe.cancel()
|
||||||
self.assertEqual(frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Requested")
|
|
||||||
|
|
||||||
pr.reload()
|
pr.reload()
|
||||||
|
self.assertEqual(pr.status, "Paid") # TODO: this might be a bug
|
||||||
|
so.reload() # reload
|
||||||
|
# regardless, since the references have already "handed-over" to SI,
|
||||||
|
# the SO keeps its historical state at the time of hand over
|
||||||
|
self.assertEqual(frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Fully Paid")
|
||||||
|
|
||||||
pr.cancel()
|
pr.cancel()
|
||||||
self.assertEqual(frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Not Requested")
|
self.assertEqual(
|
||||||
|
frappe.db.get_value(so.doctype, so.name, "advance_payment_status"), "Not Requested"
|
||||||
|
) # TODO: this might be a bug; handover has happened
|
||||||
|
|
||||||
def test_pick_list_without_rejected_materials(self):
|
def test_pick_list_without_rejected_materials(self):
|
||||||
serial_and_batch_item = make_item(
|
serial_and_batch_item = make_item(
|
||||||
|
|||||||
Reference in New Issue
Block a user