refactor(test): flaky post invoice test

This commit is contained in:
ruthra kumar
2025-06-21 09:02:40 +05:30
parent 0914fd695d
commit aeae6d4a10
2 changed files with 10 additions and 2 deletions

View File

@@ -1002,9 +1002,10 @@ class TestPOSInvoice(ERPNextTestSuite):
se.cancel()
def test_ignore_pricing_rule(self):
frappe.set_user("Administrator")
from erpnext.accounts.doctype.pricing_rule.test_pricing_rule import make_pricing_rule
item_price = frappe.get_doc(
item_price = self.truncate_make_item_price(
{
"doctype": "Item Price",
"item_code": "_Test Item",
@@ -1012,7 +1013,7 @@ class TestPOSInvoice(ERPNextTestSuite):
"price_list_rate": "450",
}
)
item_price.insert()
pr = make_pricing_rule(selling=1, priority=5, discount_percentage=10)
pr.save()

View File

@@ -145,6 +145,13 @@ class ERPNextTestSuite(unittest.TestCase):
records = load_test_records_for(doctype)
cls.globalTestRecords[doctype] = records[doctype]
@classmethod
def truncate_make_item_price(cls, record):
frappe.db.truncate("Item Price")
item_price = frappe.get_doc(record)
item_price.insert()
return item_price
@classmethod
def make_presets(cls):
from frappe.desk.page.setup_wizard.install_fixtures import update_genders, update_salutations