Skip to content

Commit

Permalink
fix(UX): dont override framework's permission check messages (backport
Browse files Browse the repository at this point in the history
…#39118) (#39119)

fix(UX): dont override framework's permission check messages (#39118)

(cherry picked from commit e84c9f7)

Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
mergify[bot] and ankush authored Jan 3, 2024
1 parent 7d64df0 commit 26ae708
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions erpnext/accounts/party.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,12 @@ def _get_party_details(
set_account_and_due_date(party, account, party_type, company, posting_date, bill_date, doctype)
)
party = party_details[party_type.lower()]
party = frappe.get_doc(party_type, party)

if not ignore_permissions and not (
frappe.has_permission(party_type, "read", party)
or frappe.has_permission(party_type, "select", party)
):
frappe.throw(_("Not permitted for {0}").format(party), frappe.PermissionError)
if not ignore_permissions:
ptype = "select" if frappe.only_has_select_perm(party_type) else "read"
frappe.has_permission(party_type, ptype, party, throw=True)

party = frappe.get_doc(party_type, party)
currency = party.get("default_currency") or currency or get_company_currency(company)

party_address, shipping_address = set_address_details(
Expand Down

0 comments on commit 26ae708

Please sign in to comment.