mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-18 10:57:56 +00:00
refactor(test): speed up item wise inventory test
(cherry picked from commit 627f2058b5)
This commit is contained in:
@@ -18,12 +18,13 @@ from erpnext.tests.utils import ERPNextTestSuite
|
|||||||
|
|
||||||
class TestItemWiseInventoryAccount(ERPNextTestSuite):
|
class TestItemWiseInventoryAccount(ERPNextTestSuite):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.company = make_company()
|
self.company = "_Test Company with perpetual inventory"
|
||||||
self.company_abbr = frappe.db.get_value("Company", self.company, "abbr")
|
self.company_abbr = "TCP1"
|
||||||
self.default_warehouse = frappe.db.get_value(
|
self.default_warehouse = frappe.db.get_value(
|
||||||
"Warehouse",
|
"Warehouse",
|
||||||
{"company": self.company, "is_group": 0, "warehouse_name": ("like", "%Stores%")},
|
{"company": self.company, "is_group": 0, "warehouse_name": ("like", "%Stores%")},
|
||||||
)
|
)
|
||||||
|
frappe.db.set_value("Company", self.company, "enable_item_wise_inventory_account", 1)
|
||||||
|
|
||||||
def test_item_account_for_purchase_receipt_entry(self):
|
def test_item_account_for_purchase_receipt_entry(self):
|
||||||
items = {
|
items = {
|
||||||
@@ -579,23 +580,3 @@ class TestItemWiseInventoryAccount(ERPNextTestSuite):
|
|||||||
gl_value = gl_value * -1
|
gl_value = gl_value * -1
|
||||||
|
|
||||||
self.assertEqual(sle_value, gl_value, f"GL Entry not created for {item_code} correctly")
|
self.assertEqual(sle_value, gl_value, f"GL Entry not created for {item_code} correctly")
|
||||||
|
|
||||||
|
|
||||||
def make_company():
|
|
||||||
company = "_Test Company for Item Wise Inventory Account"
|
|
||||||
if frappe.db.exists("Company", company):
|
|
||||||
return company
|
|
||||||
|
|
||||||
company = frappe.get_doc(
|
|
||||||
{
|
|
||||||
"doctype": "Company",
|
|
||||||
"company_name": "_Test Company for Item Wise Inventory Account",
|
|
||||||
"abbr": "_TCIWIA",
|
|
||||||
"default_currency": "INR",
|
|
||||||
"country": "India",
|
|
||||||
"enable_perpetual_inventory": 1,
|
|
||||||
"enable_item_wise_inventory_account": 1,
|
|
||||||
}
|
|
||||||
).insert()
|
|
||||||
|
|
||||||
return company.name
|
|
||||||
|
|||||||
Reference in New Issue
Block a user