mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-07 07:02:54 +00:00
fix: Updated test cases for accounting dimensions
This commit is contained in:
@@ -18,6 +18,15 @@ class TestAccountingDimension(unittest.TestCase):
|
|||||||
"document_type": "Department",
|
"document_type": "Department",
|
||||||
}).insert()
|
}).insert()
|
||||||
|
|
||||||
|
dimension1 = frappe.get_doc({
|
||||||
|
"doctype": "Accounting Dimension",
|
||||||
|
"document_type": "Location",
|
||||||
|
"mandatory_for_pl": 1
|
||||||
|
}).insert()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
delete_dimension()
|
||||||
|
|
||||||
def test_dimension_against_sales_invoice(self):
|
def test_dimension_against_sales_invoice(self):
|
||||||
si = create_sales_invoice(do_not_save=1)
|
si = create_sales_invoice(do_not_save=1)
|
||||||
si.append("items", {
|
si.append("items", {
|
||||||
@@ -51,4 +60,24 @@ class TestAccountingDimension(unittest.TestCase):
|
|||||||
self.assertEqual(gle.department, "_Test Department - _TC")
|
self.assertEqual(gle.department, "_Test Department - _TC")
|
||||||
self.assertEqual(gle1.department, "_Test Department - _TC")
|
self.assertEqual(gle1.department, "_Test Department - _TC")
|
||||||
|
|
||||||
|
def test_mandatory(self):
|
||||||
|
si = create_sales_invoice(do_not_save=1)
|
||||||
|
si.append("items", {
|
||||||
|
"item_code": "_Test Item",
|
||||||
|
"warehouse": "_Test Warehouse - _TC",
|
||||||
|
"qty": 1,
|
||||||
|
"rate": 100,
|
||||||
|
"income_account": "Sales - _TC",
|
||||||
|
"expense_account": "Cost of Goods Sold - _TC",
|
||||||
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
|
"location": ""
|
||||||
|
})
|
||||||
|
|
||||||
|
si.save()
|
||||||
|
self.assertRaises(frappe.ValidationError, si.submit())
|
||||||
|
|
||||||
|
|
||||||
|
def delete_dimension():
|
||||||
|
dimension1 = frappe.delete_doc("Accounting Diemnsion", "Department")
|
||||||
|
dimension2 = frappe.delete_doc("Accounting Diemnsion", "Location")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user