mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 11:19:09 +00:00
test: Enable basic tests
This commit is contained in:
@@ -3,108 +3,158 @@
|
|||||||
# See license.txt
|
# See license.txt
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# import frappe
|
import frappe
|
||||||
import unittest
|
import unittest
|
||||||
# test_dependencies = ['Item', 'Sales Invoice', 'Stock Entry', 'Batch']
|
test_dependencies = ['Item', 'Sales Invoice', 'Stock Entry', 'Batch']
|
||||||
|
|
||||||
|
from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation \
|
||||||
|
import EmptyStockReconciliationItemsError
|
||||||
|
|
||||||
class TestPickList(unittest.TestCase):
|
class TestPickList(unittest.TestCase):
|
||||||
|
|
||||||
def test_pick_list_picks_warehouse_for_each_item(self):
|
def test_pick_list_picks_warehouse_for_each_item(self):
|
||||||
pass
|
try:
|
||||||
# pick_list = frappe.get_doc({
|
frappe.get_doc({
|
||||||
# 'doctype': 'Pick List',
|
'doctype': 'Stock Reconciliation',
|
||||||
# 'company': '_Test Company',
|
'company': '_Test Company',
|
||||||
# 'customer': '_Test Customer',
|
'purpose': 'Opening Stock',
|
||||||
# 'items_based_on': 'Sales Order',
|
'expense_account': 'Temporary Opening - _TC',
|
||||||
# 'items': [{
|
'items': [{
|
||||||
# 'item_code': '_Test Item Home Desktop 100',
|
'item_code': '_Test Item Home Desktop 100',
|
||||||
# 'qty': 5,
|
'warehouse': '_Test Warehouse - _TC',
|
||||||
# 'stock_qty': 5,
|
'valuation_rate': 100,
|
||||||
# 'conversion_factor': 1,
|
'qty': 5
|
||||||
# 'sales_order': '_T-Sales Order-1',
|
}]
|
||||||
# 'sales_item': '_T-Sales Order-1_item',
|
}).submit()
|
||||||
# }]
|
except EmptyStockReconciliationItemsError:
|
||||||
# })
|
pass
|
||||||
# pick_list.set_item_locations()
|
|
||||||
|
|
||||||
# self.assertEqual(pick_list.locations[0].item_code, '_Test Item Home Desktop 100')
|
pick_list = frappe.get_doc({
|
||||||
# self.assertEqual(pick_list.locations[0].warehouse, '_Test Warehouse - _TC')
|
'doctype': 'Pick List',
|
||||||
# self.assertEqual(pick_list.locations[0].qty, 5)
|
'company': '_Test Company',
|
||||||
|
'customer': '_Test Customer',
|
||||||
|
'items_based_on': 'Sales Order',
|
||||||
|
'locations': [{
|
||||||
|
'item_code': '_Test Item Home Desktop 100',
|
||||||
|
'qty': 5,
|
||||||
|
'stock_qty': 5,
|
||||||
|
'conversion_factor': 1,
|
||||||
|
'sales_order': '_T-Sales Order-1',
|
||||||
|
'sales_item': '_T-Sales Order-1_item',
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
pick_list.set_item_locations()
|
||||||
|
|
||||||
# def test_pick_list_skips_out_of_stock_item(self):
|
self.assertEqual(pick_list.locations[0].item_code, '_Test Item Home Desktop 100')
|
||||||
# pick_list = frappe.get_doc({
|
self.assertEqual(pick_list.locations[0].warehouse, '_Test Warehouse - _TC')
|
||||||
# 'doctype': 'Pick List',
|
self.assertEqual(pick_list.locations[0].qty, 5)
|
||||||
# 'company': '_Test Company',
|
|
||||||
# 'customer': '_Test Customer',
|
|
||||||
# 'items_based_on': 'Sales Order',
|
|
||||||
# 'items': [{
|
|
||||||
# 'item_code': '_Test Item Warehouse Group Wise Reorder',
|
|
||||||
# 'qty': 1000,
|
|
||||||
# 'stock_qty': 1000,
|
|
||||||
# 'conversion_factor': 1,
|
|
||||||
# 'sales_order': '_T-Sales Order-1',
|
|
||||||
# 'sales_item': '_T-Sales Order-1_item',
|
|
||||||
# }]
|
|
||||||
# })
|
|
||||||
|
|
||||||
# pick_list.set_item_locations()
|
def test_pick_list_splits_row_according_to_warhouse_availability(self):
|
||||||
|
try:
|
||||||
|
frappe.get_doc({
|
||||||
|
'doctype': 'Stock Reconciliation',
|
||||||
|
'company': '_Test Company',
|
||||||
|
'purpose': 'Opening Stock',
|
||||||
|
'expense_account': 'Temporary Opening - _TC',
|
||||||
|
'items': [{
|
||||||
|
'item_code': '_Test Item Warehouse Group Wise Reorder',
|
||||||
|
'warehouse': '_Test Warehouse Group-C1 - _TC',
|
||||||
|
'valuation_rate': 100,
|
||||||
|
'qty': 5
|
||||||
|
}]
|
||||||
|
}).submit()
|
||||||
|
except EmptyStockReconciliationItemsError:
|
||||||
|
pass
|
||||||
|
|
||||||
# self.assertEqual(pick_list.locations[0].item_code, '_Test Item Warehouse Group Wise Reorder')
|
try:
|
||||||
# self.assertEqual(pick_list.locations[0].warehouse, '_Test Warehouse Group-C1 - _TC')
|
frappe.get_doc({
|
||||||
# self.assertEqual(pick_list.locations[0].qty, 30)
|
'doctype': 'Stock Reconciliation',
|
||||||
|
'company': '_Test Company',
|
||||||
|
'purpose': 'Opening Stock',
|
||||||
|
'expense_account': 'Temporary Opening - _TC',
|
||||||
|
'items': [{
|
||||||
|
'item_code': '_Test Item Warehouse Group Wise Reorder',
|
||||||
|
'warehouse': '_Test Warehouse 2 - _TC',
|
||||||
|
'valuation_rate': 400,
|
||||||
|
'qty': 10
|
||||||
|
}]
|
||||||
|
}).submit()
|
||||||
|
except EmptyStockReconciliationItemsError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
pick_list = frappe.get_doc({
|
||||||
|
'doctype': 'Pick List',
|
||||||
|
'company': '_Test Company',
|
||||||
|
'customer': '_Test Customer',
|
||||||
|
'items_based_on': 'Sales Order',
|
||||||
|
'locations': [{
|
||||||
|
'item_code': '_Test Item Warehouse Group Wise Reorder',
|
||||||
|
'qty': 1000,
|
||||||
|
'stock_qty': 1000,
|
||||||
|
'conversion_factor': 1,
|
||||||
|
'sales_order': '_T-Sales Order-1',
|
||||||
|
'sales_item': '_T-Sales Order-1_item',
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
|
||||||
# def test_pick_list_skips_items_in_expired_batch(self):
|
pick_list.set_item_locations()
|
||||||
# pass
|
|
||||||
|
|
||||||
# def test_pick_list_shows_serial_no_for_serialized_item(self):
|
self.assertEqual(pick_list.locations[0].item_code, '_Test Item Warehouse Group Wise Reorder')
|
||||||
|
self.assertEqual(pick_list.locations[0].warehouse, '_Test Warehouse Group-C1 - _TC')
|
||||||
|
self.assertEqual(pick_list.locations[0].qty, 5)
|
||||||
|
|
||||||
# stock_reconciliation = frappe.get_doc({
|
self.assertEqual(pick_list.locations[1].item_code, '_Test Item Warehouse Group Wise Reorder')
|
||||||
# 'doctype': 'Stock Reconciliation',
|
self.assertEqual(pick_list.locations[1].warehouse, '_Test Warehouse 2 - _TC')
|
||||||
# 'company': '_Test Company',
|
self.assertEqual(pick_list.locations[1].qty, 10)
|
||||||
# 'items': [{
|
|
||||||
# 'item_code': '_Test Serialized Item',
|
|
||||||
# 'warehouse': '_Test Warehouse - _TC',
|
|
||||||
# 'qty': 5,
|
|
||||||
# 'serial_no': '123450\n123451\n123452\n123453\n123454'
|
|
||||||
# }]
|
|
||||||
# })
|
|
||||||
|
|
||||||
# stock_reconciliation.submit()
|
def test_pick_list_shows_serial_no_for_serialized_item(self):
|
||||||
|
|
||||||
# pick_list = frappe.get_doc({
|
stock_reconciliation = frappe.get_doc({
|
||||||
# 'doctype': 'Pick List',
|
'doctype': 'Stock Reconciliation',
|
||||||
# 'company': '_Test Company',
|
'company': '_Test Company',
|
||||||
# 'customer': '_Test Customer',
|
'items': [{
|
||||||
# 'items_based_on': 'Sales Order',
|
'item_code': '_Test Serialized Item',
|
||||||
# 'items': [{
|
'warehouse': '_Test Warehouse - _TC',
|
||||||
# 'item_code': '_Test Serialized Item',
|
'valuation_rate': 100,
|
||||||
# 'qty': 1000,
|
'qty': 5,
|
||||||
# 'stock_qty': 1000,
|
'serial_no': '123450\n123451\n123452\n123453\n123454'
|
||||||
# 'conversion_factor': 1,
|
}]
|
||||||
# 'sales_order': '_T-Sales Order-1',
|
})
|
||||||
# 'sales_item': '_T-Sales Order-1_item',
|
|
||||||
# }]
|
|
||||||
# })
|
|
||||||
|
|
||||||
# pick_list.set_item_locations()
|
stock_reconciliation.submit()
|
||||||
# self.assertEqual(pick_list.locations[0].item_code, '_Test Serialized Item')
|
|
||||||
# self.assertEqual(pick_list.locations[0].warehouse, '_Test Warehouse - _TC')
|
|
||||||
# self.assertEqual(pick_list.locations[0].qty, 5)
|
|
||||||
# self.assertEqual(pick_list.locations[0].serial_no, '123450\n123451\n123452\n123453\n123454')
|
|
||||||
|
|
||||||
|
pick_list = frappe.get_doc({
|
||||||
|
'doctype': 'Pick List',
|
||||||
|
'company': '_Test Company',
|
||||||
|
'customer': '_Test Customer',
|
||||||
|
'items_based_on': 'Sales Order',
|
||||||
|
'locations': [{
|
||||||
|
'item_code': '_Test Serialized Item',
|
||||||
|
'qty': 1000,
|
||||||
|
'stock_qty': 1000,
|
||||||
|
'conversion_factor': 1,
|
||||||
|
'sales_order': '_T-Sales Order-1',
|
||||||
|
'sales_item': '_T-Sales Order-1_item',
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
|
||||||
|
pick_list.set_item_locations()
|
||||||
|
self.assertEqual(pick_list.locations[0].item_code, '_Test Serialized Item')
|
||||||
|
self.assertEqual(pick_list.locations[0].warehouse, '_Test Warehouse - _TC')
|
||||||
|
self.assertEqual(pick_list.locations[0].qty, 5)
|
||||||
|
self.assertEqual(pick_list.locations[0].serial_no, '123450\n123451\n123452\n123453\n123454')
|
||||||
|
|
||||||
# def test_pick_list_for_multiple_reference_doctypes(self):
|
# def test_pick_list_for_multiple_reference_doctypes(self):
|
||||||
# pass
|
# pass
|
||||||
|
|
||||||
|
# def test_pick_list_skips_items_in_expired_batch(self):
|
||||||
|
# pass
|
||||||
|
|
||||||
## records required
|
# def test_pick_list_from_sales_order(self):
|
||||||
|
# pass
|
||||||
|
|
||||||
'''
|
# def test_pick_list_from_work_order(self):
|
||||||
batch no
|
# pass
|
||||||
items
|
|
||||||
sales invoice
|
# def test_pick_list_from_material_request(self):
|
||||||
stock entries
|
# pass
|
||||||
bin
|
|
||||||
stock ledger entry
|
|
||||||
warehouses
|
|
||||||
'''
|
|
||||||
Reference in New Issue
Block a user