mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 13:24:47 +00:00
fix: remove ignore_permissions from get_party_details signature (#55491)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user