mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-29 18:04:46 +00:00
Merge pull request #47463 from ruthra-kumar/deterministic_sales_invoice_test_suite
refactor(test): flaky test case in sales invoice
This commit is contained in:
@@ -58,6 +58,10 @@ class TestAccountingDimension(IntegrationTestCase):
|
|||||||
self.assertEqual(gle1.get("department"), "_Test Department - _TC")
|
self.assertEqual(gle1.get("department"), "_Test Department - _TC")
|
||||||
|
|
||||||
def test_mandatory(self):
|
def test_mandatory(self):
|
||||||
|
location = frappe.get_doc("Accounting Dimension", "Location")
|
||||||
|
location.dimension_defaults[0].mandatory_for_bs = True
|
||||||
|
location.save()
|
||||||
|
|
||||||
si = create_sales_invoice(do_not_save=1)
|
si = create_sales_invoice(do_not_save=1)
|
||||||
si.append(
|
si.append(
|
||||||
"items",
|
"items",
|
||||||
@@ -121,7 +125,6 @@ def create_dimension():
|
|||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"reference_document": "Location",
|
"reference_document": "Location",
|
||||||
"default_dimension": "Block 1",
|
"default_dimension": "Block 1",
|
||||||
"mandatory_for_bs": 1,
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -159,6 +159,10 @@ class TestPOSClosingEntry(IntegrationTestCase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
create_dimension()
|
create_dimension()
|
||||||
|
location = frappe.get_doc("Accounting Dimension", "Location")
|
||||||
|
location.dimension_defaults[0].mandatory_for_bs = True
|
||||||
|
location.save()
|
||||||
|
|
||||||
pos_profile = make_pos_profile(do_not_insert=1, do_not_set_accounting_dimension=1)
|
pos_profile = make_pos_profile(do_not_insert=1, do_not_set_accounting_dimension=1)
|
||||||
|
|
||||||
self.assertRaises(frappe.ValidationError, pos_profile.insert)
|
self.assertRaises(frappe.ValidationError, pos_profile.insert)
|
||||||
|
|||||||
@@ -2230,13 +2230,13 @@ class TestSalesInvoice(ERPNextTestSuite):
|
|||||||
self.assertEqual(expected_account_values[1], gle.credit)
|
self.assertEqual(expected_account_values[1], gle.credit)
|
||||||
|
|
||||||
def test_rounding_adjustment_3(self):
|
def test_rounding_adjustment_3(self):
|
||||||
from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import (
|
from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import create_dimension
|
||||||
create_dimension,
|
|
||||||
disable_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()
|
create_dimension()
|
||||||
|
|
||||||
|
# rollback from tearDown() happens till here
|
||||||
si = create_sales_invoice(do_not_save=True)
|
si = create_sales_invoice(do_not_save=True)
|
||||||
si.items = []
|
si.items = []
|
||||||
for d in [(1122, 2), (1122.01, 1), (1122.01, 1)]:
|
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.cost_center, "_Test Cost Center 2 - _TC")
|
||||||
self.assertEqual(round_off_gle.location, "Block 1")
|
self.assertEqual(round_off_gle.location, "Block 1")
|
||||||
|
|
||||||
disable_dimension()
|
|
||||||
|
|
||||||
def test_sales_invoice_with_shipping_rule(self):
|
def test_sales_invoice_with_shipping_rule(self):
|
||||||
from erpnext.accounts.doctype.shipping_rule.test_shipping_rule import create_shipping_rule
|
from erpnext.accounts.doctype.shipping_rule.test_shipping_rule import create_shipping_rule
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user