Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ignore addr permission in internal code #37552

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions erpnext/controllers/selling_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import frappe
from frappe import _, bold, throw
from frappe.contacts.doctype.address.address import get_address_display
from frappe.utils import cint, flt, get_link_to_form, nowtime

from erpnext.controllers.accounts_controller import get_taxes_and_charges
Expand Down Expand Up @@ -593,6 +592,12 @@ def set_gross_profit(self):
)

def set_customer_address(self):
try:
from frappe.contacts.doctype.address.address import render_address
except ImportError:
# Older frappe versions where this function is not available
from frappe.contacts.doctype.address.address import get_address_display as render_address

address_dict = {
"customer_address": "address_display",
"shipping_address_name": "shipping_address",
Expand All @@ -602,7 +607,8 @@ def set_customer_address(self):

for address_field, address_display_field in address_dict.items():
if self.get(address_field):
self.set(address_display_field, get_address_display(self.get(address_field)))
address = frappe.call(render_address, self.get(address_field), ignore_permissions=True)
self.set(address_display_field, address)

def validate_for_duplicate_items(self):
check_list, chk_dupl_itm = [], []
Expand Down
Loading