mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +00:00
test: flaky picklist tests
This commit is contained in:
committed by
Ankush Menat
parent
c14c513214
commit
8138e53cf3
@@ -8,7 +8,7 @@ test_dependencies = ["Item", "Sales Invoice", "Stock Entry", "Batch"]
|
|||||||
|
|
||||||
from frappe.tests.utils import FrappeTestCase
|
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.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.purchase_receipt.test_purchase_receipt import make_purchase_receipt
|
||||||
from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import (
|
from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import (
|
||||||
@@ -18,6 +18,7 @@ from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import (
|
|||||||
|
|
||||||
class TestPickList(FrappeTestCase):
|
class TestPickList(FrappeTestCase):
|
||||||
def test_pick_list_picks_warehouse_for_each_item(self):
|
def test_pick_list_picks_warehouse_for_each_item(self):
|
||||||
|
item_code = make_item().name
|
||||||
try:
|
try:
|
||||||
frappe.get_doc(
|
frappe.get_doc(
|
||||||
{
|
{
|
||||||
@@ -27,7 +28,7 @@ class TestPickList(FrappeTestCase):
|
|||||||
"expense_account": "Temporary Opening - _TC",
|
"expense_account": "Temporary Opening - _TC",
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"item_code": "_Test Item",
|
"item_code": item_code,
|
||||||
"warehouse": "_Test Warehouse - _TC",
|
"warehouse": "_Test Warehouse - _TC",
|
||||||
"valuation_rate": 100,
|
"valuation_rate": 100,
|
||||||
"qty": 5,
|
"qty": 5,
|
||||||
@@ -47,7 +48,7 @@ class TestPickList(FrappeTestCase):
|
|||||||
"purpose": "Delivery",
|
"purpose": "Delivery",
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
"item_code": "_Test Item",
|
"item_code": item_code,
|
||||||
"qty": 5,
|
"qty": 5,
|
||||||
"stock_qty": 5,
|
"stock_qty": 5,
|
||||||
"conversion_factor": 1,
|
"conversion_factor": 1,
|
||||||
@@ -59,7 +60,7 @@ class TestPickList(FrappeTestCase):
|
|||||||
)
|
)
|
||||||
pick_list.set_item_locations()
|
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].warehouse, "_Test Warehouse - _TC")
|
||||||
self.assertEqual(pick_list.locations[0].qty, 5)
|
self.assertEqual(pick_list.locations[0].qty, 5)
|
||||||
|
|
||||||
@@ -270,6 +271,8 @@ class TestPickList(FrappeTestCase):
|
|||||||
pr2.cancel()
|
pr2.cancel()
|
||||||
|
|
||||||
def test_pick_list_for_items_from_multiple_sales_orders(self):
|
def test_pick_list_for_items_from_multiple_sales_orders(self):
|
||||||
|
|
||||||
|
item_code = make_item().name
|
||||||
try:
|
try:
|
||||||
frappe.get_doc(
|
frappe.get_doc(
|
||||||
{
|
{
|
||||||
@@ -279,7 +282,7 @@ class TestPickList(FrappeTestCase):
|
|||||||
"expense_account": "Temporary Opening - _TC",
|
"expense_account": "Temporary Opening - _TC",
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"item_code": "_Test Item",
|
"item_code": item_code,
|
||||||
"warehouse": "_Test Warehouse - _TC",
|
"warehouse": "_Test Warehouse - _TC",
|
||||||
"valuation_rate": 100,
|
"valuation_rate": 100,
|
||||||
"qty": 10,
|
"qty": 10,
|
||||||
@@ -295,7 +298,14 @@ class TestPickList(FrappeTestCase):
|
|||||||
"doctype": "Sales Order",
|
"doctype": "Sales Order",
|
||||||
"customer": "_Test Customer",
|
"customer": "_Test Customer",
|
||||||
"company": "_Test Company",
|
"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()
|
sales_order.submit()
|
||||||
@@ -309,7 +319,7 @@ class TestPickList(FrappeTestCase):
|
|||||||
"purpose": "Delivery",
|
"purpose": "Delivery",
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
"item_code": "_Test Item",
|
"item_code": item_code,
|
||||||
"qty": 5,
|
"qty": 5,
|
||||||
"stock_qty": 5,
|
"stock_qty": 5,
|
||||||
"conversion_factor": 1,
|
"conversion_factor": 1,
|
||||||
@@ -317,7 +327,7 @@ class TestPickList(FrappeTestCase):
|
|||||||
"sales_order_item": "_T-Sales Order-1_item",
|
"sales_order_item": "_T-Sales Order-1_item",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"item_code": "_Test Item",
|
"item_code": item_code,
|
||||||
"qty": 5,
|
"qty": 5,
|
||||||
"stock_qty": 5,
|
"stock_qty": 5,
|
||||||
"conversion_factor": 1,
|
"conversion_factor": 1,
|
||||||
@@ -329,18 +339,19 @@ class TestPickList(FrappeTestCase):
|
|||||||
)
|
)
|
||||||
pick_list.set_item_locations()
|
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].warehouse, "_Test Warehouse - _TC")
|
||||||
self.assertEqual(pick_list.locations[0].qty, 5)
|
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[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].warehouse, "_Test Warehouse - _TC")
|
||||||
self.assertEqual(pick_list.locations[1].qty, 5)
|
self.assertEqual(pick_list.locations[1].qty, 5)
|
||||||
self.assertEqual(pick_list.locations[1].sales_order_item, sales_order.items[0].name)
|
self.assertEqual(pick_list.locations[1].sales_order_item, sales_order.items[0].name)
|
||||||
|
|
||||||
def test_pick_list_for_items_with_multiple_UOM(self):
|
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()
|
purchase_receipt.submit()
|
||||||
|
|
||||||
sales_order = frappe.get_doc(
|
sales_order = frappe.get_doc(
|
||||||
@@ -350,17 +361,19 @@ class TestPickList(FrappeTestCase):
|
|||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"item_code": "_Test Item",
|
"item_code": item_code,
|
||||||
"qty": 1,
|
"qty": 1,
|
||||||
"conversion_factor": 5,
|
"conversion_factor": 5,
|
||||||
"stock_qty": 5,
|
"stock_qty": 5,
|
||||||
"delivery_date": frappe.utils.today(),
|
"delivery_date": frappe.utils.today(),
|
||||||
|
"warehouse": "_Test Warehouse - _TC",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"item_code": "_Test Item",
|
"item_code": item_code,
|
||||||
"qty": 1,
|
"qty": 1,
|
||||||
"conversion_factor": 1,
|
"conversion_factor": 1,
|
||||||
"delivery_date": frappe.utils.today(),
|
"delivery_date": frappe.utils.today(),
|
||||||
|
"warehouse": "_Test Warehouse - _TC",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
@@ -376,7 +389,7 @@ class TestPickList(FrappeTestCase):
|
|||||||
"purpose": "Delivery",
|
"purpose": "Delivery",
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
"item_code": "_Test Item",
|
"item_code": item_code,
|
||||||
"qty": 2,
|
"qty": 2,
|
||||||
"stock_qty": 1,
|
"stock_qty": 1,
|
||||||
"conversion_factor": 0.5,
|
"conversion_factor": 0.5,
|
||||||
@@ -384,7 +397,7 @@ class TestPickList(FrappeTestCase):
|
|||||||
"sales_order_item": sales_order.items[0].name,
|
"sales_order_item": sales_order.items[0].name,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"item_code": "_Test Item",
|
"item_code": item_code,
|
||||||
"qty": 1,
|
"qty": 1,
|
||||||
"stock_qty": 1,
|
"stock_qty": 1,
|
||||||
"conversion_factor": 1,
|
"conversion_factor": 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user