test: flaky picklist tests
diff --git a/erpnext/stock/doctype/pick_list/test_pick_list.py b/erpnext/stock/doctype/pick_list/test_pick_list.py
index ec5011b..27b06d2 100644
--- a/erpnext/stock/doctype/pick_list/test_pick_list.py
+++ b/erpnext/stock/doctype/pick_list/test_pick_list.py
@@ -8,7 +8,7 @@
from frappe.tests.utils import FrappeTestCase
-from erpnext.stock.doctype.item.test_item import create_item
+from erpnext.stock.doctype.item.test_item import create_item, make_item
from erpnext.stock.doctype.pick_list.pick_list import create_delivery_note
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import (
@@ -18,6 +18,7 @@
class TestPickList(FrappeTestCase):
def test_pick_list_picks_warehouse_for_each_item(self):
+ item_code = make_item().name
try:
frappe.get_doc(
{
@@ -27,7 +28,7 @@
"expense_account": "Temporary Opening - _TC",
"items": [
{
- "item_code": "_Test Item",
+ "item_code": item_code,
"warehouse": "_Test Warehouse - _TC",
"valuation_rate": 100,
"qty": 5,
@@ -47,7 +48,7 @@
"purpose": "Delivery",
"locations": [
{
- "item_code": "_Test Item",
+ "item_code": item_code,
"qty": 5,
"stock_qty": 5,
"conversion_factor": 1,
@@ -59,7 +60,7 @@
)
pick_list.set_item_locations()
- self.assertEqual(pick_list.locations[0].item_code, "_Test Item")
+ self.assertEqual(pick_list.locations[0].item_code, item_code)
self.assertEqual(pick_list.locations[0].warehouse, "_Test Warehouse - _TC")
self.assertEqual(pick_list.locations[0].qty, 5)
@@ -270,6 +271,8 @@
pr2.cancel()
def test_pick_list_for_items_from_multiple_sales_orders(self):
+
+ item_code = make_item().name
try:
frappe.get_doc(
{
@@ -279,7 +282,7 @@
"expense_account": "Temporary Opening - _TC",
"items": [
{
- "item_code": "_Test Item",
+ "item_code": item_code,
"warehouse": "_Test Warehouse - _TC",
"valuation_rate": 100,
"qty": 10,
@@ -295,7 +298,14 @@
"doctype": "Sales Order",
"customer": "_Test Customer",
"company": "_Test Company",
- "items": [{"item_code": "_Test Item", "qty": 10, "delivery_date": frappe.utils.today()}],
+ "items": [
+ {
+ "item_code": item_code,
+ "qty": 10,
+ "delivery_date": frappe.utils.today(),
+ "warehouse": "_Test Warehouse - _TC",
+ }
+ ],
}
)
sales_order.submit()
@@ -309,7 +319,7 @@
"purpose": "Delivery",
"locations": [
{
- "item_code": "_Test Item",
+ "item_code": item_code,
"qty": 5,
"stock_qty": 5,
"conversion_factor": 1,
@@ -317,7 +327,7 @@
"sales_order_item": "_T-Sales Order-1_item",
},
{
- "item_code": "_Test Item",
+ "item_code": item_code,
"qty": 5,
"stock_qty": 5,
"conversion_factor": 1,
@@ -329,18 +339,19 @@
)
pick_list.set_item_locations()
- self.assertEqual(pick_list.locations[0].item_code, "_Test Item")
+ self.assertEqual(pick_list.locations[0].item_code, item_code)
self.assertEqual(pick_list.locations[0].warehouse, "_Test Warehouse - _TC")
self.assertEqual(pick_list.locations[0].qty, 5)
self.assertEqual(pick_list.locations[0].sales_order_item, "_T-Sales Order-1_item")
- self.assertEqual(pick_list.locations[1].item_code, "_Test Item")
+ self.assertEqual(pick_list.locations[1].item_code, item_code)
self.assertEqual(pick_list.locations[1].warehouse, "_Test Warehouse - _TC")
self.assertEqual(pick_list.locations[1].qty, 5)
self.assertEqual(pick_list.locations[1].sales_order_item, sales_order.items[0].name)
def test_pick_list_for_items_with_multiple_UOM(self):
- purchase_receipt = make_purchase_receipt(item_code="_Test Item", qty=10)
+ item_code = make_item().name
+ purchase_receipt = make_purchase_receipt(item_code=item_code, qty=10)
purchase_receipt.submit()
sales_order = frappe.get_doc(
@@ -350,17 +361,19 @@
"company": "_Test Company",
"items": [
{
- "item_code": "_Test Item",
+ "item_code": item_code,
"qty": 1,
"conversion_factor": 5,
"stock_qty": 5,
"delivery_date": frappe.utils.today(),
+ "warehouse": "_Test Warehouse - _TC",
},
{
- "item_code": "_Test Item",
+ "item_code": item_code,
"qty": 1,
"conversion_factor": 1,
"delivery_date": frappe.utils.today(),
+ "warehouse": "_Test Warehouse - _TC",
},
],
}
@@ -376,7 +389,7 @@
"purpose": "Delivery",
"locations": [
{
- "item_code": "_Test Item",
+ "item_code": item_code,
"qty": 2,
"stock_qty": 1,
"conversion_factor": 0.5,
@@ -384,7 +397,7 @@
"sales_order_item": sales_order.items[0].name,
},
{
- "item_code": "_Test Item",
+ "item_code": item_code,
"qty": 1,
"stock_qty": 1,
"conversion_factor": 1,