mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-30 17:42:32 +02:00
refactor(test): make subcontracting order deterministic
This commit is contained in:
@@ -1560,7 +1560,7 @@ def make_subcontracted_item(**args):
|
||||
},
|
||||
)
|
||||
|
||||
args.raw_materials = ["_Test FG Item", "Test Extra Item 1"]
|
||||
args.raw_materials = ["_Test Extra Item 1", "Test Extra Item 2"]
|
||||
|
||||
if not frappe.db.get_value("BOM", {"item": args.item_code}, "name"):
|
||||
make_bom(item=args.item_code, raw_materials=args.get("raw_materials"))
|
||||
|
||||
@@ -40,6 +40,9 @@ class TestSubcontractingOrder(ERPNextTestSuite):
|
||||
make_service_items()
|
||||
make_bom_for_subcontracted_items()
|
||||
|
||||
def tearDown(self):
|
||||
frappe.db.rollback()
|
||||
|
||||
def test_set_missing_values(self):
|
||||
sco = get_subcontracting_order()
|
||||
before = {sco.total_qty, sco.total, sco.total_additional_costs}
|
||||
@@ -460,6 +463,7 @@ class TestSubcontractingOrder(ERPNextTestSuite):
|
||||
|
||||
set_backflush_based_on("BOM")
|
||||
|
||||
@ERPNextTestSuite.change_settings("Buying Settings", {"allow_multiple_items": True})
|
||||
def test_supplied_qty(self):
|
||||
item_code = "_Test Subcontracted FG Item 5"
|
||||
make_item("Sub Contracted Raw Material 4", {"is_stock_item": 1, "is_sub_contracted_item": 1})
|
||||
@@ -472,7 +476,7 @@ class TestSubcontractingOrder(ERPNextTestSuite):
|
||||
service_items = [
|
||||
{
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"item_code": "Subcontracted Service Item 1",
|
||||
"item_code": "Subcontracted Service Item 2",
|
||||
"qty": order_qty,
|
||||
"rate": 100,
|
||||
"fg_item": item_code,
|
||||
@@ -678,6 +682,7 @@ class TestSubcontractingOrder(ERPNextTestSuite):
|
||||
|
||||
self.assertEqual(requested_qty, new_requested_qty)
|
||||
|
||||
@ERPNextTestSuite.change_settings("System Settings", {"float_precision": 3})
|
||||
def test_subcontracting_order_rm_required_items_for_precision(self):
|
||||
item_code = "Subcontracted Item SA9"
|
||||
raw_materials = ["Subcontracted SRM Item 9"]
|
||||
|
||||
@@ -2157,6 +2157,24 @@ class ERPNextTestSuite(unittest.TestCase):
|
||||
"valuation_rate": 10000,
|
||||
"stock_uom": "_Test UOM",
|
||||
},
|
||||
{
|
||||
"doctype": "Item",
|
||||
"item_code": "_Test Extra Item 1",
|
||||
"item_name": "_Test Extra Item 1",
|
||||
"item_group": "All Item Groups",
|
||||
"company": "_Test Company",
|
||||
"is_stock_item": 1,
|
||||
"stock_uom": "_Test UOM",
|
||||
},
|
||||
{
|
||||
"doctype": "Item",
|
||||
"item_code": "_Test Extra Item 2",
|
||||
"item_name": "_Test Extra Item 2",
|
||||
"item_group": "All Item Groups",
|
||||
"company": "_Test Company",
|
||||
"is_stock_item": 1,
|
||||
"stock_uom": "_Test UOM",
|
||||
},
|
||||
]
|
||||
cls.item = []
|
||||
for x in records:
|
||||
|
||||
Reference in New Issue
Block a user