From 5c064331cb64756f6b34eacf2bb7ba169f3fcabf Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 15 Apr 2026 10:47:55 +0530 Subject: [PATCH] refactor(test): use new source for repost setting (cherry picked from commit b8207d5ed17acd537f8d6df1967e33702ad591f4) --- .../accounts/doctype/journal_entry/test_journal_entry.py | 6 +++--- .../doctype/purchase_invoice/test_purchase_invoice.py | 6 +++--- .../test_repost_accounting_ledger.py | 9 +++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py index 53d6013e1e2..833c6189c7d 100644 --- a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py @@ -413,9 +413,9 @@ class TestJournalEntry(ERPNextTestSuite): from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center # Configure Repost Accounting Ledger for JVs - settings = frappe.get_doc("Repost Accounting Ledger Settings") - if not [x for x in settings.allowed_types if x.document_type == "Journal Entry"]: - settings.append("allowed_types", {"document_type": "Journal Entry", "allowed": True}) + settings = frappe.get_doc("Accounts Settings") + if "Journal Entry" not in [x.document_type for x in settings.repost_allowed_types]: + settings.append("repost_allowed_types", {"document_type": "Journal Entry"}) settings.save() # Create JV with defaut cost center - _Test Cost Center diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index b42574ee206..5cf3c6be879 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -2256,9 +2256,9 @@ class TestPurchaseInvoice(ERPNextTestSuite, StockTestMixin): def test_repost_accounting_entries(self): # update repost settings - settings = frappe.get_doc("Repost Accounting Ledger Settings") - if not [x for x in settings.allowed_types if x.document_type == "Purchase Invoice"]: - settings.append("allowed_types", {"document_type": "Purchase Invoice", "allowed": True}) + settings = frappe.get_doc("Accounts Settings") + if "Purchase Invoice" not in [x.document_type for x in settings.repost_allowed_types]: + settings.append("repost_allowed_types", {"document_type": "Purchase Invoice"}) settings.save() pi = make_purchase_invoice( diff --git a/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py b/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py index 3200a83c122..935047e2e35 100644 --- a/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py +++ b/erpnext/accounts/doctype/repost_accounting_ledger/test_repost_accounting_ledger.py @@ -280,7 +280,8 @@ def update_repost_settings(): "Journal Entry", "Purchase Receipt", ] - repost_settings = frappe.get_doc("Repost Accounting Ledger Settings") - for x in allowed_types: - repost_settings.append("allowed_types", {"document_type": x, "allowed": True}) - repost_settings.save() + settings = frappe.get_doc("Accounts Settings") + for _type in allowed_types: + if _type not in [x.document_type for x in settings.repost_allowed_types]: + settings.append("repost_allowed_types", {"document_type": _type}) + settings.save()