remove old stock entry method/rewrite test case
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index e78d4b7..01427c2 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -397,25 +397,6 @@
return doc
@frappe.whitelist()
-def make_stock_entry(purchase_order, item_code):
- purchase_order = frappe.get_doc("Purchase Order", purchase_order)
-
- stock_entry = frappe.new_doc("Stock Entry")
- stock_entry.purpose = "Subcontract"
- stock_entry.purchase_order = purchase_order.name
- stock_entry.supplier = purchase_order.supplier
- stock_entry.supplier_name = purchase_order.supplier_name
- stock_entry.supplier_address = purchase_order.supplier_address
- stock_entry.address_display = purchase_order.address_display
- stock_entry.company = purchase_order.company
- stock_entry.from_bom = 1
- po_item = [d for d in purchase_order.items if d.item_code == item_code][0]
- stock_entry.fg_completed_qty = po_item.qty
- stock_entry.bom_no = po_item.bom
- stock_entry.get_items()
- return stock_entry.as_dict()
-
-@frappe.whitelist()
def make_rm_stock_entry(purchase_order, rm_items):
if isinstance(rm_items, basestring):
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index 5ae4d3b..86a1337 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -6,8 +6,9 @@
import frappe
import frappe.defaults
from frappe.utils import flt, add_days, nowdate
-from erpnext.buying.doctype.purchase_order.purchase_order import (make_purchase_receipt, make_purchase_invoice, make_stock_entry as make_subcontract_transfer_entry)
+from erpnext.buying.doctype.purchase_order.purchase_order import (make_purchase_receipt, make_purchase_invoice, make_rm_stock_entry as make_subcontract_transfer_entry)
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
+import json
class TestPurchaseOrder(unittest.TestCase):
def test_make_purchase_receipt(self):
@@ -202,11 +203,11 @@
self.assertEquals(bin2.projected_qty, bin1.projected_qty - 10)
# Create stock transfer
- se = frappe.get_doc(make_subcontract_transfer_entry(po.name, "_Test FG Item"))
+ rm_item = [{"item_code":"_Test FG Item","rm_item_code":"_Test Item","item_name":"_Test Item",
+ "qty":6,"warehouse":"_Test Warehouse - _TC","rate":100,"amount":600,"stock_uom":"Nos"}]
+ rm_item_string = json.dumps(rm_item)
+ se = frappe.get_doc(make_subcontract_transfer_entry(po.name, rm_item_string))
se.to_warehouse = "_Test Warehouse 1 - _TC"
- for d in se.get("items"):
- if d.item_code == "_Test Item":
- d.qty = 6
se.save()
se.submit()