From efb8336bf89b6bbf89d22e3e786e32571c798b1a Mon Sep 17 00:00:00 2001 From: Shllokkk <140623894+Shllokkk@users.noreply.github.com> Date: Wed, 3 Jun 2026 10:51:44 +0530 Subject: [PATCH] fix: remove ignore_permissions from get_party_details signature (#55491) --- .../accounts/doctype/sales_invoice/sales_invoice.py | 4 ++-- erpnext/accounts/party.py | 5 +---- .../request_for_quotation/request_for_quotation.py | 4 ++-- erpnext/buying/doctype/supplier/test_supplier.py | 6 +++--- erpnext/controllers/buying_controller.py | 4 ++-- erpnext/selling/doctype/customer/test_customer.py | 12 ++++++------ .../customer_wise_item_price.py | 4 ++-- 7 files changed, 18 insertions(+), 21 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index db1e56a2b7c..ff990c5bb91 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -29,7 +29,7 @@ from erpnext.accounts.doctype.repost_accounting_ledger.repost_accounting_ledger ) from erpnext.accounts.doctype.tax_withholding_entry.tax_withholding_entry import SalesTaxWithholding from erpnext.accounts.general_ledger import get_round_off_account_and_cost_center -from erpnext.accounts.party import get_due_date, get_party_account, get_party_details +from erpnext.accounts.party import _get_party_details, get_due_date, get_party_account from erpnext.accounts.utils import ( get_account_currency, update_voucher_outstanding, @@ -3042,7 +3042,7 @@ def update_taxes( master_doctype=None, ): # Update Party Details - party_details = get_party_details( + party_details = _get_party_details( party=party, party_type=party_type, company=company, diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index fa82b3e9188..df891f9df6c 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -65,7 +65,6 @@ def get_party_details( price_list: str | None = None, currency: str | None = None, doctype: str | None = None, - ignore_permissions: bool | None = False, fetch_payment_terms_template: bool = True, party_address: str | None = None, company_address: str | None = None, @@ -75,8 +74,6 @@ def get_party_details( ): if not party: return frappe._dict() - if not frappe.db.exists(party_type, party): - frappe.throw(_("{0}: {1} does not exists").format(party_type, party)) return _get_party_details( party, account, @@ -87,7 +84,7 @@ def get_party_details( price_list, currency, doctype, - ignore_permissions, + False, fetch_payment_terms_template, party_address, company_address, diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py index 3611bd244a6..dff53355004 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py @@ -16,7 +16,7 @@ from frappe.utils import get_url from frappe.utils.print_format import download_pdf from frappe.utils.user import get_user_fullname -from erpnext.accounts.party import get_party_account_currency, get_party_details +from erpnext.accounts.party import _get_party_details, get_party_account_currency from erpnext.buying.utils import validate_for_items from erpnext.controllers.buying_controller import BuyingController from erpnext.stock.doctype.material_request.material_request import set_missing_values @@ -454,7 +454,7 @@ def make_supplier_quotation_from_rfq( def postprocess(source, target_doc): if for_supplier: target_doc.supplier = for_supplier - args = get_party_details(for_supplier, party_type="Supplier", ignore_permissions=True) + args = _get_party_details(for_supplier, party_type="Supplier", ignore_permissions=True) target_doc.currency = args.currency or get_party_account_currency( "Supplier", for_supplier, source.company ) diff --git a/erpnext/buying/doctype/supplier/test_supplier.py b/erpnext/buying/doctype/supplier/test_supplier.py index 48684f49739..8f41296f57e 100644 --- a/erpnext/buying/doctype/supplier/test_supplier.py +++ b/erpnext/buying/doctype/supplier/test_supplier.py @@ -118,12 +118,12 @@ class TestSupplier(ERPNextTestSuite): self.assertEqual(supplier.country, "Greece") def test_party_details_tax_category(self): - from erpnext.accounts.party import get_party_details + from erpnext.accounts.party import _get_party_details frappe.delete_doc_if_exists("Address", "_Test Address With Tax Category-Billing") # Tax Category without Address - details = get_party_details("_Test Supplier With Tax Category", party_type="Supplier") + details = _get_party_details("_Test Supplier With Tax Category", party_type="Supplier") self.assertEqual(details.tax_category, "_Test Tax Category 1") address = frappe.get_doc( @@ -138,7 +138,7 @@ class TestSupplier(ERPNextTestSuite): ).insert() # Tax Category with Address - details = get_party_details("_Test Supplier With Tax Category", party_type="Supplier") + details = _get_party_details("_Test Supplier With Tax Category", party_type="Supplier") self.assertEqual(details.tax_category, "_Test Tax Category 2") # Rollback diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index e5847c449a9..1ee6789f8d0 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -13,7 +13,7 @@ from frappe.utils.data import nowtime import erpnext from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_dimensions from erpnext.accounts.doctype.budget.budget import validate_expense_against_budget -from erpnext.accounts.party import get_party_details +from erpnext.accounts.party import _get_party_details from erpnext.buying.utils import update_last_purchase_rate, validate_for_items from erpnext.controllers.accounts_controller import get_taxes_and_charges from erpnext.controllers.sales_and_purchase_return import get_rate_for_return @@ -213,7 +213,7 @@ class BuyingController(SubcontractingController): # set contact and address details for supplier, if they are not mentioned if getattr(self, "supplier", None): self.update_if_missing( - get_party_details( + _get_party_details( self.supplier, party_type="Supplier", doctype=self.doctype, diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index 4bd26408c67..ba17f9ed4a8 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -53,7 +53,7 @@ class TestCustomer(ERPNextTestSuite): doc.delete() def test_party_details(self): - from erpnext.accounts.party import get_party_details + from erpnext.accounts.party import _get_party_details to_check = { "selling_price_list": None, @@ -75,7 +75,7 @@ class TestCustomer(ERPNextTestSuite): "Contact", "_Test Contact for _Test Customer-_Test Customer", "is_primary_contact", 1 ) - details = get_party_details("_Test Customer") + details = _get_party_details("_Test Customer") for key, value in to_check.items(): val = details.get(key) @@ -85,10 +85,10 @@ class TestCustomer(ERPNextTestSuite): self.assertEqual(value, val) def test_party_details_tax_category(self): - from erpnext.accounts.party import get_party_details + from erpnext.accounts.party import _get_party_details # Tax Category without Address - details = get_party_details("_Test Customer With Tax Category") + details = _get_party_details("_Test Customer With Tax Category") self.assertEqual(details.tax_category, "_Test Tax Category 1") frappe.get_doc( @@ -120,13 +120,13 @@ class TestCustomer(ERPNextTestSuite): # Tax Category from Billing Address settings.determine_address_tax_category_from = "Billing Address" settings.save() - details = get_party_details("_Test Customer With Tax Category") + details = _get_party_details("_Test Customer With Tax Category") self.assertEqual(details.tax_category, "_Test Tax Category 2") # Tax Category from Shipping Address settings.determine_address_tax_category_from = "Shipping Address" settings.save() - details = get_party_details("_Test Customer With Tax Category") + details = _get_party_details("_Test Customer With Tax Category") self.assertEqual(details.tax_category, "_Test Tax Category 3") # Rollback diff --git a/erpnext/selling/report/customer_wise_item_price/customer_wise_item_price.py b/erpnext/selling/report/customer_wise_item_price/customer_wise_item_price.py index d9caa9b8bad..f6783abfbe5 100644 --- a/erpnext/selling/report/customer_wise_item_price/customer_wise_item_price.py +++ b/erpnext/selling/report/customer_wise_item_price/customer_wise_item_price.py @@ -7,7 +7,7 @@ from frappe import _, qb from frappe.query_builder import Criterion from erpnext import get_default_company -from erpnext.accounts.party import get_party_details +from erpnext.accounts.party import _get_party_details def execute(filters=None): @@ -125,7 +125,7 @@ def get_data(filters=None): def get_customer_details(filters): - customer_details = get_party_details(party=filters.get("customer"), party_type="Customer") + customer_details = _get_party_details(party=filters.get("customer"), party_type="Customer") customer_details.update( {"company": get_default_company(), "price_list": customer_details.get("selling_price_list")} )