mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-25 14:11:45 +01:00
refactor(test): make cost center
This commit is contained in:
@@ -187,6 +187,7 @@ class ERPNextTestSuite(unittest.TestCase):
|
||||
cls.make_territory()
|
||||
cls.make_customer_group()
|
||||
cls.make_user()
|
||||
cls.make_cost_center()
|
||||
cls.update_stock_settings()
|
||||
|
||||
frappe.db.commit()
|
||||
@@ -1077,6 +1078,45 @@ class ERPNextTestSuite(unittest.TestCase):
|
||||
frappe.get_doc("Supplier Group", {"supplier_group_name": x.get("supplier_group_name")})
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def make_cost_center(cls):
|
||||
records = [
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"cost_center_name": "_Test Cost Center",
|
||||
"doctype": "Cost Center",
|
||||
"is_group": 0,
|
||||
"parent_cost_center": "_Test Company - _TC",
|
||||
},
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"cost_center_name": "_Test Cost Center 2",
|
||||
"doctype": "Cost Center",
|
||||
"is_group": 0,
|
||||
"parent_cost_center": "_Test Company - _TC",
|
||||
},
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"cost_center_name": "_Test Write Off Cost Center",
|
||||
"doctype": "Cost Center",
|
||||
"is_group": 0,
|
||||
"parent_cost_center": "_Test Company - _TC",
|
||||
},
|
||||
]
|
||||
cls.cost_center = []
|
||||
for x in records:
|
||||
if not frappe.db.exists(
|
||||
"Cost Center", {"cost_center_name": x.get("cost_center_name"), "company": x.get("company")}
|
||||
):
|
||||
cls.cost_center.append(frappe.get_doc(x).insert())
|
||||
else:
|
||||
cls.cost_center.append(
|
||||
frappe.get_doc(
|
||||
"Cost Center",
|
||||
{"cost_center_name": x.get("cost_center_name"), "company": x.get("company")},
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@ERPNextTestSuite.registerAs(staticmethod)
|
||||
@contextmanager
|
||||
|
||||
Reference in New Issue
Block a user