mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-12 14:11:46 +00:00
fix: remove ignore_permissions from get_party_details signature (#55491)
(cherry picked from commit efb8336bf8)
This commit is contained in:
@@ -2994,7 +2994,7 @@ def update_taxes(
|
|||||||
master_doctype=None,
|
master_doctype=None,
|
||||||
):
|
):
|
||||||
# Update Party Details
|
# Update Party Details
|
||||||
party_details = get_party_details(
|
party_details = _get_party_details(
|
||||||
party=party,
|
party=party,
|
||||||
party_type=party_type,
|
party_type=party_type,
|
||||||
company=company,
|
company=company,
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ class DuplicatePartyAccountError(frappe.ValidationError):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_party_details(
|
def get_party_details(
|
||||||
|
<<<<<<< HEAD
|
||||||
party=None,
|
party=None,
|
||||||
account=None,
|
account=None,
|
||||||
party_type="Customer",
|
party_type="Customer",
|
||||||
@@ -90,11 +91,26 @@ def get_party_details(
|
|||||||
shipping_address=None,
|
shipping_address=None,
|
||||||
dispatch_address=None,
|
dispatch_address=None,
|
||||||
pos_profile=None,
|
pos_profile=None,
|
||||||
|
=======
|
||||||
|
party: str | None = None,
|
||||||
|
account: str | None = None,
|
||||||
|
party_type: str = "Customer",
|
||||||
|
company: str | None = None,
|
||||||
|
posting_date: str | None = None,
|
||||||
|
bill_date: str | None = None,
|
||||||
|
price_list: str | None = None,
|
||||||
|
currency: str | None = None,
|
||||||
|
doctype: str | None = None,
|
||||||
|
fetch_payment_terms_template: bool = True,
|
||||||
|
party_address: str | None = None,
|
||||||
|
company_address: str | None = None,
|
||||||
|
shipping_address: str | None = None,
|
||||||
|
dispatch_address: str | None = None,
|
||||||
|
pos_profile: str | None = None,
|
||||||
|
>>>>>>> efb8336bf8 (fix: remove ignore_permissions from get_party_details signature (#55491))
|
||||||
):
|
):
|
||||||
if not party:
|
if not party:
|
||||||
return frappe._dict()
|
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(
|
return _get_party_details(
|
||||||
party,
|
party,
|
||||||
account,
|
account,
|
||||||
@@ -105,7 +121,7 @@ def get_party_details(
|
|||||||
price_list,
|
price_list,
|
||||||
currency,
|
currency,
|
||||||
doctype,
|
doctype,
|
||||||
ignore_permissions,
|
False,
|
||||||
fetch_payment_terms_template,
|
fetch_payment_terms_template,
|
||||||
party_address,
|
party_address,
|
||||||
company_address,
|
company_address,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from frappe.utils import get_url
|
|||||||
from frappe.utils.print_format import download_pdf
|
from frappe.utils.print_format import download_pdf
|
||||||
from frappe.utils.user import get_user_fullname
|
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.buying.utils import validate_for_items
|
||||||
from erpnext.controllers.buying_controller import BuyingController
|
from erpnext.controllers.buying_controller import BuyingController
|
||||||
from erpnext.stock.doctype.material_request.material_request import set_missing_values
|
from erpnext.stock.doctype.material_request.material_request import set_missing_values
|
||||||
@@ -447,7 +447,7 @@ def make_supplier_quotation_from_rfq(source_name, target_doc=None, for_supplier=
|
|||||||
def postprocess(source, target_doc):
|
def postprocess(source, target_doc):
|
||||||
if for_supplier:
|
if for_supplier:
|
||||||
target_doc.supplier = 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(
|
target_doc.currency = args.currency or get_party_account_currency(
|
||||||
"Supplier", for_supplier, source.company
|
"Supplier", for_supplier, source.company
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -119,12 +119,12 @@ class TestSupplier(ERPNextTestSuite):
|
|||||||
self.assertEqual(supplier.country, "Greece")
|
self.assertEqual(supplier.country, "Greece")
|
||||||
|
|
||||||
def test_party_details_tax_category(self):
|
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")
|
frappe.delete_doc_if_exists("Address", "_Test Address With Tax Category-Billing")
|
||||||
|
|
||||||
# Tax Category without Address
|
# 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")
|
self.assertEqual(details.tax_category, "_Test Tax Category 1")
|
||||||
|
|
||||||
address = frappe.get_doc(
|
address = frappe.get_doc(
|
||||||
@@ -139,7 +139,7 @@ class TestSupplier(ERPNextTestSuite):
|
|||||||
).insert()
|
).insert()
|
||||||
|
|
||||||
# Tax Category with Address
|
# 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")
|
self.assertEqual(details.tax_category, "_Test Tax Category 2")
|
||||||
|
|
||||||
# Rollback
|
# Rollback
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from frappe.utils.data import nowtime
|
|||||||
import erpnext
|
import erpnext
|
||||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_dimensions
|
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.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.buying.utils import update_last_purchase_rate, validate_for_items
|
||||||
from erpnext.controllers.accounts_controller import get_taxes_and_charges
|
from erpnext.controllers.accounts_controller import get_taxes_and_charges
|
||||||
from erpnext.controllers.sales_and_purchase_return import get_rate_for_return
|
from erpnext.controllers.sales_and_purchase_return import get_rate_for_return
|
||||||
@@ -218,7 +218,7 @@ class BuyingController(SubcontractingController):
|
|||||||
# set contact and address details for supplier, if they are not mentioned
|
# set contact and address details for supplier, if they are not mentioned
|
||||||
if getattr(self, "supplier", None):
|
if getattr(self, "supplier", None):
|
||||||
self.update_if_missing(
|
self.update_if_missing(
|
||||||
get_party_details(
|
_get_party_details(
|
||||||
self.supplier,
|
self.supplier,
|
||||||
party_type="Supplier",
|
party_type="Supplier",
|
||||||
doctype=self.doctype,
|
doctype=self.doctype,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class TestCustomer(ERPNextTestSuite):
|
|||||||
doc.delete()
|
doc.delete()
|
||||||
|
|
||||||
def test_party_details(self):
|
def test_party_details(self):
|
||||||
from erpnext.accounts.party import get_party_details
|
from erpnext.accounts.party import _get_party_details
|
||||||
|
|
||||||
to_check = {
|
to_check = {
|
||||||
"selling_price_list": None,
|
"selling_price_list": None,
|
||||||
@@ -75,7 +75,7 @@ class TestCustomer(ERPNextTestSuite):
|
|||||||
"Contact", "_Test Contact for _Test Customer-_Test Customer", "is_primary_contact", 1
|
"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():
|
for key, value in to_check.items():
|
||||||
val = details.get(key)
|
val = details.get(key)
|
||||||
@@ -85,10 +85,10 @@ class TestCustomer(ERPNextTestSuite):
|
|||||||
self.assertEqual(value, val)
|
self.assertEqual(value, val)
|
||||||
|
|
||||||
def test_party_details_tax_category(self):
|
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
|
# 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")
|
self.assertEqual(details.tax_category, "_Test Tax Category 1")
|
||||||
|
|
||||||
frappe.get_doc(
|
frappe.get_doc(
|
||||||
@@ -120,13 +120,13 @@ class TestCustomer(ERPNextTestSuite):
|
|||||||
# Tax Category from Billing Address
|
# Tax Category from Billing Address
|
||||||
settings.determine_address_tax_category_from = "Billing Address"
|
settings.determine_address_tax_category_from = "Billing Address"
|
||||||
settings.save()
|
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")
|
self.assertEqual(details.tax_category, "_Test Tax Category 2")
|
||||||
|
|
||||||
# Tax Category from Shipping Address
|
# Tax Category from Shipping Address
|
||||||
settings.determine_address_tax_category_from = "Shipping Address"
|
settings.determine_address_tax_category_from = "Shipping Address"
|
||||||
settings.save()
|
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")
|
self.assertEqual(details.tax_category, "_Test Tax Category 3")
|
||||||
|
|
||||||
# Rollback
|
# Rollback
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from frappe import _, qb
|
|||||||
from frappe.query_builder import Criterion
|
from frappe.query_builder import Criterion
|
||||||
|
|
||||||
from erpnext import get_default_company
|
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):
|
def execute(filters=None):
|
||||||
@@ -125,7 +125,7 @@ def get_data(filters=None):
|
|||||||
|
|
||||||
|
|
||||||
def get_customer_details(filters):
|
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(
|
customer_details.update(
|
||||||
{"company": get_default_company(), "price_list": customer_details.get("selling_price_list")}
|
{"company": get_default_company(), "price_list": customer_details.get("selling_price_list")}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user