From 74f8d65021aef62550345549d9de4e919041e8f6 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 8 May 2025 12:07:23 +0530 Subject: [PATCH] refactor(test): deterministic test suite for sales invoice --- .../accounting_dimension/test_accounting_dimension.py | 1 - .../doctype/sales_invoice/test_sales_invoice.py | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py index ccc9f1353b6..c3d1e295c8b 100644 --- a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py +++ b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py @@ -121,7 +121,6 @@ def create_dimension(): "company": "_Test Company", "reference_document": "Location", "default_dimension": "Block 1", - "mandatory_for_bs": 1, }, ) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 367f3f82ccd..692ba62218b 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -2230,13 +2230,13 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(expected_account_values[1], gle.credit) def test_rounding_adjustment_3(self): - from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import ( - create_dimension, - disable_dimension, - ) + from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import create_dimension + # Dimension creates custom field, which does an implicit DB commit as it is a DDL command + # Ensure dimension don't have any mandatory fields create_dimension() + # rollback from tearDown() happens till here si = create_sales_invoice(do_not_save=True) si.items = [] for d in [(1122, 2), (1122.01, 1), (1122.01, 1)]: @@ -2317,8 +2317,6 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(round_off_gle.cost_center, "_Test Cost Center 2 - _TC") self.assertEqual(round_off_gle.location, "Block 1") - disable_dimension() - def test_sales_invoice_with_shipping_rule(self): from erpnext.accounts.doctype.shipping_rule.test_shipping_rule import create_shipping_rule