fix: added code for testing
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index a33d401..643e7cf 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -1064,6 +1064,7 @@
so.company = args.company or "_Test Company"
so.customer = args.customer or "_Test Customer"
so.currency = args.currency or "INR"
+ so.po_no = args.po_no or '12345'
if args.selling_price_list:
so.selling_price_list = args.selling_price_list
diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
index 0168613..9566af7 100644
--- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
@@ -442,9 +442,15 @@
self.assertEqual(dn.status, "To Bill")
self.assertEqual(dn.per_billed, 0)
+ # Testing if Customer's Purchase Order No was rightly copied
+ self.assertEqual(dn.po_no, so.po_no)
+
si = make_sales_invoice(dn.name)
si.submit()
+ # Testing if Customer's Purchase Order No was rightly copied
+ self.assertEqual(dn.po_no, si.po_no)
+
dn.load_from_db()
self.assertEqual(dn.get("items")[0].billed_amt, 200)
self.assertEqual(dn.per_billed, 100)
@@ -461,16 +467,25 @@
si.insert()
si.submit()
+ # Testing if Customer's Purchase Order No was rightly copied
+ self.assertEqual(so.po_no, si.po_no)
+
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
dn1 = make_delivery_note(so.name)
dn1.get("items")[0].qty = 2
dn1.submit()
+ # Testing if Customer's Purchase Order No was rightly copied
+ self.assertEqual(so.po_no, dn1.po_no)
+
dn2 = make_delivery_note(so.name)
dn2.get("items")[0].qty = 3
dn2.submit()
+ # Testing if Customer's Purchase Order No was rightly copied
+ self.assertEqual(so.po_no, dn2.po_no)
+
dn1.load_from_db()
self.assertEqual(dn1.get("items")[0].billed_amt, 200)
self.assertEqual(dn1.per_billed, 100)
@@ -492,9 +507,15 @@
dn1.get("items")[0].qty = 2
dn1.submit()
+ # Testing if Customer's Purchase Order No was rightly copied
+ self.assertEqual(dn1.po_no, so.po_no)
+
si1 = make_sales_invoice(dn1.name)
si1.submit()
+ # Testing if Customer's Purchase Order No was rightly copied
+ self.assertEqual(dn1.po_no, si1.po_no)
+
dn1.load_from_db()
self.assertEqual(dn1.per_billed, 100)
@@ -502,10 +523,16 @@
si2.get("items")[0].qty = 4
si2.submit()
+ # Testing if Customer's Purchase Order No was rightly copied
+ self.assertEqual(si2.po_no, so.po_no)
+
dn2 = make_delivery_note(so.name)
dn2.get("items")[0].qty = 5
dn2.submit()
+ # Testing if Customer's Purchase Order No was rightly copied
+ self.assertEqual(dn2.po_no, so.po_no)
+
dn1.load_from_db()
self.assertEqual(dn1.get("items")[0].billed_amt, 200)
self.assertEqual(dn1.per_billed, 100)
@@ -525,9 +552,15 @@
si = make_sales_invoice(so.name)
si.submit()
+ # Testing if Customer's Purchase Order No was rightly copied
+ self.assertEqual(so.po_no, si.po_no)
+
dn = make_delivery_note(si.name)
dn.submit()
+ # Testing if Customer's Purchase Order No was rightly copied
+ self.assertEqual(dn.po_no, si.po_no)
+
self.assertEqual(dn.get("items")[0].billed_amt, 1000)
self.assertEqual(dn.per_billed, 100)
self.assertEqual(dn.status, "Completed")